Return API key name in _authentication response#78946
Merged
justincr-elastic merged 38 commits intoelastic:masterfrom Oct 29, 2021
Merged
Return API key name in _authentication response#78946justincr-elastic merged 38 commits intoelastic:masterfrom
justincr-elastic merged 38 commits intoelastic:masterfrom
Conversation
Responses to POST /_security/api_key includes id, name, metadata, api_key (shared secret), and encoded (base64 of id:api_key). Requests to GET /_security/_authenticate returns data about the user, but not the API KEY. When authenticating using an API KEY, return API KEY info map in the response. The initial feature request asked for 'name'. However, the request's Authentication header contains 'encoded', so the decoded 'id' will be returned for convenience too. When authenticating using any other method, API KEY info map is omitted. Closes elastic#70306
Responses to POST /_security/api_key includes id, name, metadata, api_key (shared secret), and encoded (base64 of id:api_key). Requests to GET /_security/_authenticate returns data about the user, but not the API KEY. When authenticating using an API KEY, return API KEY info map in the response. The initial feature request asked for 'name'. However, the request's Authentication header contains 'encoded', so the decoded 'id' will be returned for convenience too. When authenticating using any other method, API KEY info map is omitted. Closes elastic#70306
tvernum
reviewed
Oct 13, 2021
...gin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/AuthenticationResult.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/TokenService.java
Outdated
Show resolved
Hide resolved
ywangd
reviewed
Oct 14, 2021
Member
ywangd
left a comment
There was a problem hiding this comment.
I didn't really look into the client side code. But here are a few things on the server side.
...lugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/ApiKeyServiceField.java
Outdated
Show resolved
Hide resolved
...curity-trial/src/javaRestTest/java/org/elasticsearch/xpack/security/apikey/ApiKeyRestIT.java
Outdated
Show resolved
Hide resolved
...src/javaRestTest/java/org/elasticsearch/xpack/security/authc/SecurityRealmSmokeTestCase.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/ApiKeyService.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/api_key/10_basic.yml
Show resolved
Hide resolved
...l-realms/src/javaRestTest/java/org/elasticsearch/xpack/security/authc/NativeRealmAuthIT.java
Outdated
Show resolved
Hide resolved
...nt/rest-high-level/src/main/java/org/elasticsearch/client/security/AuthenticateResponse.java
Outdated
Show resolved
Hide resolved
...ck/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/Authentication.java
Outdated
Show resolved
Hide resolved
# Conflicts: # x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authz/store/CompositeRolesStoreTests.java
Fix merge issue.
Contributor
Author
|
@elasticmachine update branch |
...plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/ApiKeyServiceTests.java
Outdated
Show resolved
Hide resolved
Contributor
Author
|
@elasticmachine update branch |
Collaborator
|
merge conflict between base and head |
Contributor
Author
|
@elasticmachine update branch |
Collaborator
|
merge conflict between base and head |
4ba6dee to
15e140a
Compare
Contributor
Author
|
@elasticmachine update branch |
991db2e to
8da4cb1
Compare
ff24e60 to
96884c1
Compare
Contributor
Author
|
@elasticmachine update branch |
ywangd
approved these changes
Oct 29, 2021
Member
ywangd
left a comment
There was a problem hiding this comment.
LGTM. (Not sure why my previous disappeared. But I approved already a couple days back.)
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Responses to POST /_security/api_key includes id, name, metadata,
api_key (shared secret), and encoded (base64 of id:api_key).
Requests to GET /_security/_authenticate returns data about the user,
but not the API KEY.
When authenticating using an API KEY, return API KEY info map in the
response. The initial feature request asked for 'name'. However, the
request's Authentication header contains 'encoded', so the decoded
'id' will be returned for convenience too.
When authenticating using any other method, API KEY info map is
omitted.
Closes #70306
Example request:
Example response: