-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FTR] support custom native roles in serverless tests (#194677)
## Summary This PR updates FTR services to support authentication with custom native role. Few notes: - for compatibility with MKI we reserve **"customRole"** as a custom role name used in tests - test user is **automatically assigned** to this role, but before login in browser/ generating cookie header or API key in each test suite **role privileges must me updated according test scenario** How to test: I added a new test file for Search project: `x-pack/test_serverless/functional/test_suites/search/custom_role_access.ts` It can be run locally with: ``` node scripts/functional_tests --config=x-pack/test_serverless/functional/test_suites/search/config.ts --grep "With custom role" ``` FTR UI test example: ```ts // First set privileges for custom role await samlAuth.setCustomRole({ elasticsearch: { indices: [{ names: ['logstash-*'], privileges: ['read', 'view_index_metadata'] }], }, kibana: [ { feature: { discover: ['read'], }, spaces: ['*'], }, ], }); }); // Then you can login in browser as a user with newly defined privileges await pageObjects.svlCommonPage.loginWithCustomRole(); ``` FTR api_integration test example: ```ts // First set privileges for custom role await samlAuth.setCustomRole({ elasticsearch: { indices: [{ names: ['logstash-*'], privileges: ['read', 'view_index_metadata'] }], }, kibana: [ { feature: { discover: ['read'], }, spaces: ['*'], }, ], }); }); // Then you can generate an API key with newly defined privileges const roleAuthc = await samlAuth.createM2mApiKeyWithRoleScope('customRole'); // Don't forget to invalidate the API key in the end await samlAuth.invalidateM2mApiKeyWithRoleScope(roleAuthc); ```
- Loading branch information
1 parent
3252d04
commit f00ac7a
Showing
14 changed files
with
321 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.