-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Add cloud API keys to auth info report #130041
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
Add cloud API keys to auth info report #130041
Conversation
Pinging @elastic/es-security (Team:Security) |
String apiKeyId = randomAlphaOfLength(20); | ||
Authentication authentication = AuthenticationTestHelper.randomCloudApiKeyAuthentication(apiKeyId); | ||
String json = generateJson(Map.of(AuthenticationField.AUTHENTICATION_KEY, authentication.encode())); | ||
assertThat(json, containsString("{\"authorization\":{\"cloud_api_key\":{\"id\":\"" + apiKeyId + "\"")); |
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.
Test only asserts id
field. Using randomCloudApiKeyAuthentication(apiKeyId)
may not be quite suitable here. Probably it's better to randomize User
then call randomCloudApiKeyAuthentication(user)
. This way you can assert all fields as you control user's principal (API key id
), metadata (name
and internal
) and roles
.
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.
refactored the test and some helper methods to assert on a fully randomized user
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.
LGTM 👍
* add change and test * improve test
No description provided.