Class GetTokenRequest
- All Implemented Interfaces:
JsonpSerializable
Create a bearer token for access without requiring basic authentication. The
tokens are created by the Elasticsearch Token Service, which is automatically
enabled when you configure TLS on the HTTP interface. Alternatively, you can
explicitly enable the xpack.security.authc.token.enabled
setting. When you are running in production mode, a bootstrap check prevents
you from enabling the token service unless you also enable TLS on the HTTP
interface.
The get token API takes the same parameters as a typical OAuth 2.0 token API except for the use of a JSON request body.
A successful get token API call returns a JSON structure that contains the access token, the amount of time (seconds) that the token expires in, the type, and the scope if available.
The tokens returned by the get token API have a finite period of time for
which they are valid and after that time period, they can no longer be used.
That time period is defined by the
xpack.security.authc.token.timeout
setting. If you want to
invalidate a token immediately, you can do so by using the invalidate token
API.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class co.elastic.clients.elasticsearch._types.RequestBase
RequestBase.AbstractBuilder<BuilderT extends RequestBase.AbstractBuilder<BuilderT>>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JsonpDeserializer<GetTokenRequest>
Json deserializer forGetTokenRequest
static final Endpoint<GetTokenRequest,
GetTokenResponse, ErrorResponse> Endpoint "security.get_token
". -
Method Summary
Modifier and TypeMethodDescriptionfinal AccessTokenGrantType
The type of grant.final String
The base64 encoded kerberos ticket.static GetTokenRequest
final String
password()
The user's password.final String
The string that was returned when you created the token, which enables you to extend its life.final String
scope()
The scope of the token.void
serialize
(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) Serialize this object to JSON.protected void
serializeInternal
(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper) protected static void
final String
username()
The username that identifies the user.Methods inherited from class co.elastic.clients.elasticsearch._types.RequestBase
toString
-
Field Details
-
_DESERIALIZER
Json deserializer forGetTokenRequest
-
_ENDPOINT
Endpoint "security.get_token
".
-
-
Method Details
-
of
public static GetTokenRequest of(Function<GetTokenRequest.Builder, ObjectBuilder<GetTokenRequest>> fn) -
grantType
The type of grant. Supported grant types are:password
,_kerberos
,client_credentials
, andrefresh_token
.API name:
grant_type
-
kerberosTicket
The base64 encoded kerberos ticket. If you specify the_kerberos
grant type, this parameter is required. This parameter is not valid with any other supported grant type.API name:
kerberos_ticket
-
password
The user's password. If you specify thepassword
grant type, this parameter is required. This parameter is not valid with any other supported grant type.API name:
password
-
refreshToken
The string that was returned when you created the token, which enables you to extend its life. If you specify therefresh_token
grant type, this parameter is required. This parameter is not valid with any other supported grant type.API name:
refresh_token
-
scope
The scope of the token. Currently tokens are only issued for a scope of FULL regardless of the value sent with the request.API name:
scope
-
username
The username that identifies the user. If you specify thepassword
grant type, this parameter is required. This parameter is not valid with any other supported grant type.API name:
username
-
serialize
Serialize this object to JSON.- Specified by:
serialize
in interfaceJsonpSerializable
-
serializeInternal
-
setupGetTokenRequestDeserializer
protected static void setupGetTokenRequestDeserializer(ObjectDeserializer<GetTokenRequest.Builder> op)
-