elasticsearch/docs/reference/rest-api/security/authenticate.asciidoc
James Rodewig 255c9a7f95
[DOCS] Move x-pack docs to docs/reference dir (#99209)
**Problem:**
For historical reasons, source files for the Elasticsearch Guide's security, watcher, and Logstash API docs are housed in the `x-pack/docs` directory. This can confuse new contributors who expect Elasticsearch Guide docs to be located in `docs/reference`. 

**Solution:**
- Move the security, watcher, and Logstash API doc source files to the `docs/reference` directory
- Update doc snippet tests to use security

Rel: https://github.com/elastic/platform-docs-team/issues/208
2023-09-12 14:53:41 -04:00

64 lines
1.7 KiB
Text

[role="xpack"]
[[security-api-authenticate]]
=== Authenticate API
++++
<titleabbrev>Authenticate</titleabbrev>
++++
Enables you to submit a request with a basic auth header to
authenticate a user and retrieve information about the authenticated user.
[[security-api-authenticate-request]]
==== {api-request-title}
`GET /_security/_authenticate`
[[security-api-authenticate-desc]]
==== {api-description-title}
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.
[[security-api-authenticate-response-codes]]
==== {api-response-codes-title}
If the user cannot be authenticated, this API returns a 401 status code.
[[security-api-authenticate-example]]
==== {api-examples-title}
To authenticate a user, submit a GET request to the
`/_security/_authenticate` endpoint:
[source,console]
--------------------------------------------------
GET /_security/_authenticate
--------------------------------------------------
The following example output provides information about the "rdeniro" user:
[source,console-result]
--------------------------------------------------
{
"username": "rdeniro",
"roles": [
"admin"
],
"full_name": null,
"email": null,
"metadata": { },
"enabled": true,
"authentication_realm": {
"name" : "file",
"type" : "file"
},
"lookup_realm": {
"name" : "file",
"type" : "file"
},
"authentication_type": "realm"
}
--------------------------------------------------
// TESTRESPONSE[s/"rdeniro"/"$body.username"/]
// TESTRESPONSE[s/"admin"/"_es_test_root"/]