2017-06-28 14:02:40 -04:00
|
|
|
[role="xpack"]
|
2017-04-06 21:04:39 -04:00
|
|
|
[[security-api-authenticate]]
|
|
|
|
=== Authenticate API
|
2018-12-20 13:23:28 -05:00
|
|
|
++++
|
|
|
|
<titleabbrev>Authenticate</titleabbrev>
|
|
|
|
++++
|
2017-04-06 21:04:39 -04:00
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
Enables you to submit a request with a basic auth header to
|
2017-04-06 21:04:39 -04:00
|
|
|
authenticate a user and retrieve information about the authenticated user.
|
|
|
|
|
2017-09-22 13:07:15 -04:00
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-authenticate-request]]
|
|
|
|
==== {api-request-title}
|
2017-09-22 13:07:15 -04:00
|
|
|
|
2018-12-11 04:13:10 -05:00
|
|
|
`GET /_security/_authenticate`
|
2017-09-22 13:07:15 -04:00
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-authenticate-desc]]
|
|
|
|
==== {api-description-title}
|
2017-09-22 13:07:15 -04:00
|
|
|
|
2018-11-27 16:35:42 -05:00
|
|
|
A successful call returns a JSON structure that shows user information such as their username, the roles that are
|
|
|
|
assigned to the user, any assigned metadata, and information about the realms that authenticated and authorized the user.
|
2017-09-22 13:07:15 -04:00
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-authenticate-response-codes]]
|
|
|
|
==== {api-response-codes-title}
|
|
|
|
|
2017-09-22 13:07:15 -04:00
|
|
|
If the user cannot be authenticated, this API returns a 401 status code.
|
|
|
|
|
2019-08-02 13:56:05 -04:00
|
|
|
[[security-api-authenticate-example]]
|
|
|
|
==== {api-examples-title}
|
2017-09-22 13:07:15 -04:00
|
|
|
|
|
|
|
To authenticate a user, submit a GET request to the
|
2018-12-11 04:13:10 -05:00
|
|
|
`/_security/_authenticate` endpoint:
|
2017-04-06 21:04:39 -04:00
|
|
|
|
2019-09-05 14:12:39 -04:00
|
|
|
[source,console]
|
2017-04-06 21:04:39 -04:00
|
|
|
--------------------------------------------------
|
2018-12-11 04:13:10 -05:00
|
|
|
GET /_security/_authenticate
|
2017-04-06 21:04:39 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
|
2017-09-22 13:07:15 -04:00
|
|
|
The following example output provides information about the "rdeniro" user:
|
2017-04-06 21:04:39 -04:00
|
|
|
|
2019-09-05 14:12:39 -04:00
|
|
|
[source,console-result]
|
2017-04-06 21:04:39 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"username": "rdeniro",
|
2020-08-21 08:59:43 -04:00
|
|
|
"roles": [
|
2018-06-18 11:48:23 -04:00
|
|
|
"admin"
|
2017-05-12 02:51:47 -04:00
|
|
|
],
|
2018-06-18 11:48:23 -04:00
|
|
|
"full_name": null,
|
|
|
|
"email": null,
|
|
|
|
"metadata": { },
|
2018-11-27 16:35:42 -05:00
|
|
|
"enabled": true,
|
|
|
|
"authentication_realm": {
|
2019-06-04 07:08:41 -04:00
|
|
|
"name" : "file",
|
2018-11-27 16:35:42 -05:00
|
|
|
"type" : "file"
|
|
|
|
},
|
|
|
|
"lookup_realm": {
|
2019-06-04 07:08:41 -04:00
|
|
|
"name" : "file",
|
2018-11-27 16:35:42 -05:00
|
|
|
"type" : "file"
|
2020-08-21 08:59:43 -04:00
|
|
|
},
|
|
|
|
"authentication_type": "realm"
|
2017-04-06 21:04:39 -04:00
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2018-06-18 11:48:23 -04:00
|
|
|
// TESTRESPONSE[s/"rdeniro"/"$body.username"/]
|
2020-08-21 08:59:43 -04:00
|
|
|
// TESTRESPONSE[s/"admin"/"superuser"/]
|