AuthN v0.2.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.
Currently, this function assumes the password is hashed using the Argon2
function. Argon2
is recommended over bcrypt
. See argon2_elixir
package.
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.