Files
elasticsearch-js/docs/reference-security-authenticate.asciidoc
2024-12-05 14:46:52 -06:00

83 lines
4.6 KiB
Plaintext

[[reference-security-authenticate]]
////////
===========================================================================================================================
|| ||
|| ||
|| ||
|| ██████╗ ███████╗ █████╗ ██████╗ ███╗ ███╗███████╗ ||
|| ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝ ||
|| ██████╔╝█████╗ ███████║██║ ██║██╔████╔██║█████╗ ||
|| ██╔══██╗██╔══╝ ██╔══██║██║ ██║██║╚██╔╝██║██╔══╝ ||
|| ██║ ██║███████╗██║ ██║██████╔╝██║ ╚═╝ ██║███████╗ ||
|| ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝╚══════╝ ||
|| ||
|| ||
|| This file is autogenerated, DO NOT send pull requests that changes this file directly. ||
|| You should update the script that does the generation, which can be found in: ||
|| https://github.com/elastic/elastic-client-generator-js ||
|| ||
|| You can run the script with the following command: ||
|| npm run elasticsearch -- --version <version> ||
|| ||
|| ||
|| ||
===========================================================================================================================
////////
[discrete]
[[client.security.authenticate]]
=== client.security.authenticate
Authenticate a user. Authenticates a user and returns information about the authenticated user. Include the user information in a [basic auth header](https://en.wikipedia.org/wiki/Basic_access_authentication). 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.
{ref}/security-api-authenticate.html[{es} documentation]
[discrete]
==== Function signature
[source,ts]
----
(SecurityAuthenticateRequest, options?): Promise<SecurityAuthenticateResponse>
----
[discrete]
==== Request
[pass]
++++
<pre>
++++
interface SecurityAuthenticateRequest extends <<RequestBase>> {
}
[pass]
++++
</pre>
++++
[discrete]
==== Response
[pass]
++++
<pre>
++++
interface SecurityAuthenticateResponse {
api_key?: <<SecurityApiKey>>
authentication_realm: <<SecurityRealmInfo>>
email?: string | null
full_name?: <<Name>> | null
lookup_realm: <<SecurityRealmInfo>>
metadata: <<Metadata>>
roles: string[]
username: <<Username>>
enabled: boolean
authentication_type: string
token?: SecurityAuthenticateToken
}
[pass]
++++
</pre>
++++