kibana/x-pack/test/security_api_integration/saml.config.ts
Robert Oskamp 9a52c90fb8
[9.0] [kbn-scout] add test config category to reporting (#210167) (#217504)
# Backport

This will backport the following commits from `main` to `9.0`:
- [[kbn-scout] add test config category to reporting
(#210167)](https://github.com/elastic/kibana/pull/210167)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Robert
Oskamp","email":"robert.oskamp@elastic.co"},"sourceCommit":{"committedDate":"2025-02-12T10:17:04Z","message":"[kbn-scout]
add test config category to reporting (#210167)\n\n##
Summary\r\n\r\nThis PR adds a test config category to the scout
reporting. This allows\r\nus to distinguish between UI and API FTR
tests.\r\nA new property `testConfigCategory` has been added to all FTR
configs\r\nthat don't already inherit it from a higher level
config.","sha":"4bd80160b24fc2d136608d95e320291d3074eba2","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","ci:project-deploy-observability","Team:obs-ux-infra_services","backport:version","v9.1.0","v8.19.0"],"title":"[kbn-scout]
add test config category to
reporting","number":210167,"url":"https://github.com/elastic/kibana/pull/210167","mergeCommit":{"message":"[kbn-scout]
add test config category to reporting (#210167)\n\n##
Summary\r\n\r\nThis PR adds a test config category to the scout
reporting. This allows\r\nus to distinguish between UI and API FTR
tests.\r\nA new property `testConfigCategory` has been added to all FTR
configs\r\nthat don't already inherit it from a higher level
config.","sha":"4bd80160b24fc2d136608d95e320291d3074eba2"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/210167","number":210167,"mergeCommit":{"message":"[kbn-scout]
add test config category to reporting (#210167)\n\n##
Summary\r\n\r\nThis PR adds a test config category to the scout
reporting. This allows\r\nus to distinguish between UI and API FTR
tests.\r\nA new property `testConfigCategory` has been added to all FTR
configs\r\nthat don't already inherit it from a higher level
config.","sha":"4bd80160b24fc2d136608d95e320291d3074eba2"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/210802","number":210802,"state":"MERGED","mergeCommit":{"sha":"84c90d5bb4749eb1d898d1ab242bbce73d6d9353","message":"[8.x]
[kbn-scout] add test config category to reporting (#210167)
(#210802)\n\n# Backport\n\nThis will backport the following commits from
`main` to `8.x`:\n- [[kbn-scout] add test config category to
reporting\n(#210167)](https://github.com/elastic/kibana/pull/210167)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n"}}]}]
BACKPORT-->
2025-04-08 17:03:42 +02:00

70 lines
2.9 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { resolve } from 'path';
import { ScoutTestRunConfigCategory } from '@kbn/scout-info';
import type { FtrConfigProviderContext } from '@kbn/test';
import { services } from './services';
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const xPackAPITestsConfig = await readConfigFile(require.resolve('../api_integration/config.ts'));
const kibanaPort = xPackAPITestsConfig.get('servers.kibana.port');
const idpPath = require.resolve('@kbn/security-api-integration-helpers/saml/idp_metadata.xml');
const testEndpointsPlugin = resolve(__dirname, '../security_functional/plugins/test_endpoints');
const auditLogPath = resolve(__dirname, './packages/helpers/audit/saml.log');
return {
testConfigCategory: ScoutTestRunConfigCategory.API_TEST,
testFiles: [require.resolve('./tests/saml')],
servers: xPackAPITestsConfig.get('servers'),
security: { disableTestUser: true },
services,
junit: {
reportName: 'X-Pack Security API Integration Tests (SAML)',
},
esTestCluster: {
...xPackAPITestsConfig.get('esTestCluster'),
serverArgs: [
...xPackAPITestsConfig.get('esTestCluster.serverArgs'),
'xpack.security.authc.token.enabled=true',
'xpack.security.authc.token.timeout=15s',
'xpack.security.authc.realms.saml.saml1.order=0',
`xpack.security.authc.realms.saml.saml1.idp.metadata.path=${idpPath}`,
'xpack.security.authc.realms.saml.saml1.idp.entity_id=http://www.elastic.co/saml1',
`xpack.security.authc.realms.saml.saml1.sp.entity_id=http://localhost:${kibanaPort}`,
`xpack.security.authc.realms.saml.saml1.sp.logout=http://localhost:${kibanaPort}/logout`,
`xpack.security.authc.realms.saml.saml1.sp.acs=http://localhost:${kibanaPort}/api/security/saml/callback`,
'xpack.security.authc.realms.saml.saml1.attributes.principal=urn:oid:0.0.7',
],
},
kbnTestServer: {
...xPackAPITestsConfig.get('kbnTestServer'),
serverArgs: [
...xPackAPITestsConfig.get('kbnTestServer.serverArgs'),
`--plugin-path=${testEndpointsPlugin}`,
`--xpack.security.authc.providers=${JSON.stringify(['saml', 'basic'])}`,
'--xpack.security.authc.saml.realm=saml1',
'--xpack.security.authc.saml.maxRedirectURLSize=100b',
'--xpack.security.audit.enabled=true',
'--xpack.security.audit.appender.type=file',
`--xpack.security.audit.appender.fileName=${auditLogPath}`,
'--xpack.security.audit.appender.layout.type=json',
`--xpack.security.audit.ignore_filters=${JSON.stringify([
{ actions: ['http_request'] },
{ categories: ['database'] },
])}`,
],
},
};
}