Skip to content

[DOCS] Add grant API key to Java HLRC #63783

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

Merged
merged 3 commits into from
Feb 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions docs/java-rest/high-level/security/grant-api-key.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
--
:api: grant-api-key
:request: GrantApiKeyRequest
:response: CreateApiKeyResponse
--
[role="xpack"]
[id="{upid}-{api}"]
=== Grant API key API

Creates an API key on behalf of another user.

[id="{upid}-{api}-request"]
==== Grant API key request

This API is similar to <<java-rest-high-security-create-api-key>>, however it
creates the API key for a user that is different than the user that runs the API.

A +{request}+ contains authentication credentials for the user on whose behalf
the API key will be created, a grant type (which indicates whether the
credentials are an access token or a user ID and password), and API key details.
The API key details include a name for the API key, an optional list of role
descriptors to define permissions, and an optional expiration for the
generated API key. If expiration is not provided, by default the API keys do not
expire.

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-request]
--------------------------------------------------

include::../execution.asciidoc[]

[id="{upid}-{api}-response"]
==== Grant API key response

The returned +{response}+ contains an ID, API key, name for the API key, and
optional expiration.

["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------
include-tagged::{doc-tests-file}[{api}-response]
--------------------------------------------------
<1> The API key that can be used to authenticate to Elasticsearch.
<2> Expiration details, if the API keys expire.
1 change: 1 addition & 0 deletions docs/java-rest/high-level/supported-apis.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ include::security/create-token.asciidoc[]
include::security/invalidate-token.asciidoc[]
include::security/put-privileges.asciidoc[]
include::security/create-api-key.asciidoc[]
include::security/grant-api-key.asciidoc[]
include::security/get-api-key.asciidoc[]
include::security/invalidate-api-key.asciidoc[]

Expand Down