ArangoDB's Authentication operations.
Every function takes the pool as its first argument and returns the decoded
response body. See Arangox.API.Client for the options they all accept and
for what a 404 returns.
Summary
Functions
List all access tokens
List all access tokens. Raises on error.
Create an access token
Create an access token. Raises on error.
Create a JWT session token
Create a JWT session token. Raises on error.
Delete an access token
Delete an access token. Raises on error.
Hot-reload the JWT secret(s) from disk
Hot-reload the JWT secret(s) from disk. Raises on error.
Get information about the loaded JWT secrets
Get information about the loaded JWT secrets. Raises on error.
Functions
@spec all_access_tokens(Arangox.conn(), binary(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
List all access tokens
List the access tokens for a given user.
This only returns the access token metadata. The actual access token strings are only shown when creating tokens.
The user account you authenticate with needs to have administrate access
to the _system database if you want to list the access tokens for a
different user. You can always list your own access tokens,
regardless of database access levels.
Returns
Recorded against ArangoDB 3.12.10:
%{
"tokens" => []
}
@spec all_access_tokens!(Arangox.conn(), binary(), keyword()) :: term()
List all access tokens. Raises on error.
See all_access_tokens/2.
@spec create_access_token(Arangox.conn(), binary(), term(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Create an access token
Create a new access token for the given user.
The response includes the actual access token string that you need to store in a secure manner. It is only shown once.
The user account you authenticate with needs to have administrate access
to the _system database if you want to create an access token for a
different user. You can always create an access token for yourself,
regardless of database access levels.
@spec create_access_token!(Arangox.conn(), binary(), term(), keyword()) :: term()
Create an access token. Raises on error.
@spec create_session_token(Arangox.conn(), term(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Create a JWT session token
Obtain a JSON Web Token (JWT) from the credentials of an ArangoDB user account
or a user's access token.
You can use the JWT in the Authorization HTTP header as a Bearer token to
authenticate requests.
The lifetime for the token is controlled by the --server.session-timeout
startup option.
@spec create_session_token!(Arangox.conn(), term(), keyword()) :: term()
Create a JWT session token. Raises on error.
@spec delete_access_token(Arangox.conn(), binary(), binary(), keyword()) :: {:ok, term()} | {:error, Exception.t()}
Delete an access token
Delete an access token with the specified identifier for the given user.
The user account you authenticate with needs to have administrate access
to the _system database if you want to delete an access token for a
different user. You can always delete your own access tokens,
regardless of database access levels.
@spec delete_access_token!(Arangox.conn(), binary(), binary(), keyword()) :: term()
Delete an access token. Raises on error.
@spec reload_server_jwt_secrets( Arangox.conn(), keyword() ) :: {:ok, term()} | {:error, Exception.t()}
Hot-reload the JWT secret(s) from disk
Sending a request without payload to this endpoint reloads the JWT secret(s)
from disk. Only the files specified via the arangod startup option
--server.jwt-secret-keyfile or --server.jwt-secret-folder are used.
It is not possible to change the locations where files are loaded from
without restarting the process.
To utilize the API a superuser JWT token is necessary, otherwise the response will be HTTP 403 Forbidden.
@spec reload_server_jwt_secrets!( Arangox.conn(), keyword() ) :: term()
Hot-reload the JWT secret(s) from disk. Raises on error.
@spec server_jwt_secrets( Arangox.conn(), keyword() ) :: {:ok, term()} | {:error, Exception.t()}
Get information about the loaded JWT secrets
Get information about the currently loaded secrets.
To utilize the API a superuser JWT token is necessary, otherwise the response will be HTTP 403 Forbidden.
Returns
Recorded against ArangoDB 3.12.10:
%{
"code" => integer,
"error" => boolean,
"result" => %{
"active" => %{
"sha256" => string
},
"passive" => []
}
}
@spec server_jwt_secrets!( Arangox.conn(), keyword() ) :: term()
Get information about the loaded JWT secrets. Raises on error.
See server_jwt_secrets/1.