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
|
|
|
|
|
|
|
The Authenticate API enables you to submit a request with a basic auth header to
|
|
|
|
authenticate a user and retrieve information about the authenticated user.
|
|
|
|
|
2017-09-22 13:07:15 -04:00
|
|
|
|
|
|
|
==== Request
|
|
|
|
|
2018-12-11 04:13:10 -05:00
|
|
|
`GET /_security/_authenticate`
|
2017-09-22 13:07:15 -04:00
|
|
|
|
|
|
|
|
|
|
|
==== Description
|
|
|
|
|
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
|
|
|
|
|
|
|
If the user cannot be authenticated, this API returns a 401 status code.
|
|
|
|
|
|
|
|
==== Examples
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
2018-12-11 04:13:10 -05:00
|
|
|
GET /_security/_authenticate
|
2017-04-06 21:04:39 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
|
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
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"username": "rdeniro",
|
2018-06-18 11:48:23 -04:00
|
|
|
"roles": [
|
|
|
|
"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"
|
|
|
|
}
|
2017-04-06 21:04:39 -04:00
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2018-06-18 11:48:23 -04:00
|
|
|
// TESTRESPONSE[s/"rdeniro"/"$body.username"/]
|
|
|
|
// TESTRESPONSE[s/"admin"/"superuser"/]
|