1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- [role="xpack"]
- [[security-api-authenticate]]
- === Authenticate API
- 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.
- ==== Request
- `GET _xpack/security/_authenticate`
- ==== Description
- 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.
- If the user cannot be authenticated, this API returns a 401 status code.
- ==== Examples
- To authenticate a user, submit a GET request to the
- `_xpack/security/_authenticate` endpoint:
- [source,js]
- --------------------------------------------------
- GET _xpack/security/_authenticate
- --------------------------------------------------
- // CONSOLE
- The following example output provides information about the "rdeniro" user:
- [source,js]
- --------------------------------------------------
- {
- "username": "rdeniro",
- "roles": [
- "admin"
- ],
- "full_name": null,
- "email": null,
- "metadata": { },
- "enabled": true,
- "authentication_realm": {
- "name" : "default_file",
- "type" : "file"
- },
- "lookup_realm": {
- "name" : "default_file",
- "type" : "file"
- }
- }
- --------------------------------------------------
- // TESTRESPONSE[s/"rdeniro"/"$body.username"/]
- // TESTRESPONSE[s/"admin"/"superuser"/]
|