-
Notifications
You must be signed in to change notification settings - Fork 8.6k
feat(security,serverless): enable UIAM mode by default #260546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,8 @@ import { SamlSessionManager } from '@kbn/test'; | |
| import expect from '@kbn/expect'; | ||
| import { REPO_ROOT } from '@kbn/repo-info'; | ||
| import { resolve } from 'path'; | ||
| import getopts from 'getopts'; | ||
| import type { ServerlessProjectType } from '@kbn/es'; | ||
| import type { FtrProviderContext } from '../ftr_provider_context'; | ||
| import { getAuthProvider } from './get_auth_provider'; | ||
| import type { InternalRequestHeader } from './default_request_headers'; | ||
|
|
@@ -53,6 +55,11 @@ export function SamlAuthProvider({ getService }: FtrProviderContext) { | |
| const customRolesFileName = process.env.ROLES_FILENAME_OVERRIDE; | ||
| const cloudUsersFilePath = resolve(REPO_ROOT, '.ftr', customRolesFileName ?? 'role_users.json'); | ||
|
|
||
| const kbnServerOptions = getopts(config.get('kbnTestServer.serverArgs'), { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: Replicates what we do for Scout. |
||
| boolean: ['xpack.security.uiam.enabled'], | ||
| string: ['serverless', 'xpack.cloud.organization_id'], | ||
| }); | ||
|
|
||
| // Sharing the instance within FTR config run means cookies are persistent for each role between tests. | ||
| const sessionManager = new SamlSessionManager({ | ||
| hostOptions: { | ||
|
|
@@ -69,6 +76,13 @@ export function SamlAuthProvider({ getService }: FtrProviderContext) { | |
| sourcePath: authRoleProvider.getRolesDefinitionPath(), | ||
| }, | ||
| cloudUsersFilePath, | ||
| serverless: !!kbnServerOptions.serverless | ||
| ? { | ||
| uiam: kbnServerOptions['xpack.security.uiam.enabled'] ?? false, | ||
| projectType: kbnServerOptions.serverless as ServerlessProjectType, | ||
| organizationId: kbnServerOptions['xpack.cloud.organization_id']!, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is required by the UIAM session token, so it must be defined in ECS and is optional for non-Cloud users in ECH.
I'm setting it in the base config for both Serverless Scout and API integration tests, or do you think it should be defined elsewhere?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All good, thank you 👍 |
||
| } | ||
| : undefined, | ||
| }); | ||
|
|
||
| const DEFAULT_ROLE = authRoleProvider.getDefaultRole(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* | ||
| * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
| * Public License v 1"; you may not use this file except in compliance with, at | ||
| * your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
| * License v3.0 only", or the "Server Side Public License, v 1". | ||
| */ | ||
|
|
||
| import { resolve } from 'path'; | ||
| import { REPO_ROOT } from '@kbn/repo-info'; | ||
| import { servers as defaultConfig } from '../../default/serverless/observability_logs_essentials.serverless.config'; | ||
| import type { ScoutServerConfig } from '../../../../../types'; | ||
|
|
||
| // We need to test certain APIs that are only exposed by the plugin contract and not through | ||
| // any HTTP endpoint, so this test plugin exposes these APIs through test HTTP endpoints that | ||
| // we can call in our tests. | ||
| const pluginPath = `--plugin-path=${resolve( | ||
| REPO_ROOT, | ||
| 'x-pack/platform/test/security_functional/plugins/test_endpoints' | ||
| )}`; | ||
|
|
||
| export const servers: ScoutServerConfig = { | ||
| ...defaultConfig, | ||
| kbnTestServer: { | ||
| ...defaultConfig.kbnTestServer, | ||
| serverArgs: [...defaultConfig.kbnTestServer.serverArgs, pluginPath], | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* | ||
| * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
| * Public License v 1"; you may not use this file except in compliance with, at | ||
| * your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
| * License v3.0 only", or the "Server Side Public License, v 1". | ||
| */ | ||
|
|
||
| import { resolve } from 'path'; | ||
| import { REPO_ROOT } from '@kbn/repo-info'; | ||
| import { servers as defaultConfig } from '../../default/serverless/search.serverless.config'; | ||
| import type { ScoutServerConfig } from '../../../../../types'; | ||
|
|
||
| // We need to test certain APIs that are only exposed by the plugin contract and not through | ||
| // any HTTP endpoint, so this test plugin exposes these APIs through test HTTP endpoints that | ||
| // we can call in our tests. | ||
| const pluginPath = `--plugin-path=${resolve( | ||
| REPO_ROOT, | ||
| 'x-pack/platform/test/security_functional/plugins/test_endpoints' | ||
| )}`; | ||
|
|
||
| export const servers: ScoutServerConfig = { | ||
| ...defaultConfig, | ||
| kbnTestServer: { | ||
| ...defaultConfig.kbnTestServer, | ||
| serverArgs: [...defaultConfig.kbnTestServer.serverArgs, pluginPath], | ||
| }, | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: it's a way too noisy.