2017-06-29 02:02:40 +08:00
|
|
|
[role="xpack"]
|
2017-04-07 09:04:39 +08:00
|
|
|
[[security-api-authenticate]]
|
|
|
|
=== Authenticate API
|
2018-12-21 02:23:28 +08:00
|
|
|
++++
|
|
|
|
<titleabbrev>Authenticate</titleabbrev>
|
|
|
|
++++
|
2017-04-07 09:04:39 +08:00
|
|
|
|
2025-01-01 04:02:59 +08:00
|
|
|
.New API reference
|
|
|
|
[sidebar]
|
|
|
|
--
|
|
|
|
For the most up-to-date API details, refer to {api-es}/group/endpoint-security[Security APIs].
|
|
|
|
--
|
|
|
|
|
2019-08-03 01:56:05 +08:00
|
|
|
Enables you to submit a request with a basic auth header to
|
2017-04-07 09:04:39 +08:00
|
|
|
authenticate a user and retrieve information about the authenticated user.
|
|
|
|
|
2017-09-23 01:07:15 +08:00
|
|
|
|
2019-08-03 01:56:05 +08:00
|
|
|
[[security-api-authenticate-request]]
|
|
|
|
==== {api-request-title}
|
2017-09-23 01:07:15 +08:00
|
|
|
|
2018-12-11 17:13:10 +08:00
|
|
|
`GET /_security/_authenticate`
|
2017-09-23 01:07:15 +08:00
|
|
|
|
2019-08-03 01:56:05 +08:00
|
|
|
[[security-api-authenticate-desc]]
|
|
|
|
==== {api-description-title}
|
2017-09-23 01:07:15 +08:00
|
|
|
|
2018-11-28 05:35:42 +08: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-23 01:07:15 +08:00
|
|
|
|
2019-08-03 01:56:05 +08:00
|
|
|
[[security-api-authenticate-response-codes]]
|
|
|
|
==== {api-response-codes-title}
|
|
|
|
|
2017-09-23 01:07:15 +08:00
|
|
|
If the user cannot be authenticated, this API returns a 401 status code.
|
|
|
|
|
2019-08-03 01:56:05 +08:00
|
|
|
[[security-api-authenticate-example]]
|
|
|
|
==== {api-examples-title}
|
2017-09-23 01:07:15 +08:00
|
|
|
|
|
|
|
To authenticate a user, submit a GET request to the
|
2018-12-11 17:13:10 +08:00
|
|
|
`/_security/_authenticate` endpoint:
|
2017-04-07 09:04:39 +08:00
|
|
|
|
2019-09-05 23:54:56 +08:00
|
|
|
[source,console]
|
2017-04-07 09:04:39 +08:00
|
|
|
--------------------------------------------------
|
2018-12-11 17:13:10 +08:00
|
|
|
GET /_security/_authenticate
|
2017-04-07 09:04:39 +08:00
|
|
|
--------------------------------------------------
|
|
|
|
|
2017-09-23 01:07:15 +08:00
|
|
|
The following example output provides information about the "rdeniro" user:
|
2017-04-07 09:04:39 +08:00
|
|
|
|
2019-09-05 23:54:56 +08:00
|
|
|
[source,console-result]
|
2017-04-07 09:04:39 +08:00
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"username": "rdeniro",
|
2020-08-21 19:59:13 +08:00
|
|
|
"roles": [
|
2018-06-18 23:48:23 +08:00
|
|
|
"admin"
|
2017-05-12 14:51:47 +08:00
|
|
|
],
|
2018-06-18 23:48:23 +08:00
|
|
|
"full_name": null,
|
|
|
|
"email": null,
|
|
|
|
"metadata": { },
|
2018-11-28 05:35:42 +08:00
|
|
|
"enabled": true,
|
|
|
|
"authentication_realm": {
|
2019-05-20 18:47:58 +08:00
|
|
|
"name" : "file",
|
2018-11-28 05:35:42 +08:00
|
|
|
"type" : "file"
|
|
|
|
},
|
|
|
|
"lookup_realm": {
|
2019-05-20 18:47:58 +08:00
|
|
|
"name" : "file",
|
2018-11-28 05:35:42 +08:00
|
|
|
"type" : "file"
|
2020-08-21 19:59:13 +08:00
|
|
|
},
|
|
|
|
"authentication_type": "realm"
|
2017-04-07 09:04:39 +08:00
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2018-06-18 23:48:23 +08:00
|
|
|
// TESTRESPONSE[s/"rdeniro"/"$body.username"/]
|
2022-01-17 09:00:38 +08:00
|
|
|
// TESTRESPONSE[s/"admin"/"_es_test_root"/]
|