AuthN v0.3.0 AuthN.Authenticator.DBAuthenticator View Source
Link to this section Summary
Functions
Authenticates a user's credentials against a given repository and schema.
Link to this section Functions
Authenticates a user's credentials against a given repository and schema.
The given schema must implement the AuthN.Ecto.AuthNFields
behaviour, which
allows this function to retrieve the identifier and password schema field names.
By default, this function uses the Argon2
password-hashing function from the
argon2_elixir
library. The default may be replaced by passing a module name to
the :hashing_module
option that implements the Comeonin
and
Comeonin.PasswordHash
behaviours from the comeonin
library, such as Bcrypt
from the bcrypt_elixir
library.
Returns the tuple {:ok, user}
in case of successful authentication (where user
is the struct fetched from the data store that aligns with the given credentials),
{:error, :unknown_user}
in case the given identifier is not found in the data
store, and {:error, :wrong_password}
in case the given password doesn't match the
one found in the data store.