View Source Mobilizon.Service.Auth.Authenticator behaviour (Mobilizon v5.0.0-beta.1)
Module to handle authentification (currently through database or LDAP)
Summary
Functions
Generates access token for an user.
Generates refresh token for an user.
Generates access token and refresh token for an user.
Types
@type tokens_with_user() :: %{ access_token: String.t(), refresh_token: String.t(), user: Mobilizon.Users.User.t() }
@type ttl() :: {pos_integer(), :second | :minute | :hour | :week}
Callbacks
@callback can_change_email?(Mobilizon.Users.User.t()) :: boolean()
@callback can_change_password?(Mobilizon.Users.User.t()) :: boolean()
@callback login(String.t(), String.t()) :: {:ok, Mobilizon.Users.User.t()} | {:error, any()}
@callback provider_name() :: String.t() | nil
Functions
@spec authenticate(String.t(), String.t()) :: {:ok, tokens_with_user()}
@spec can_reset_password?(Mobilizon.Users.User.t()) :: boolean()
@spec fetch_user(String.t()) :: Mobilizon.Users.User.t() | {:error, :user_not_found}
@spec generate_access_token( Mobilizon.Users.User.t() | ApplicationToken.t(), ttl() | nil ) :: {:ok, String.t()} | {:error, any()}
Generates access token for an user.
@spec generate_refresh_token( Mobilizon.Users.User.t() | ApplicationToken.t(), ttl() | nil ) :: {:ok, String.t()} | {:error, any()}
Generates refresh token for an user.
@spec generate_tokens(Mobilizon.Users.User.t() | ApplicationToken.t()) :: {:ok, tokens()} | {:error, any()}
Generates access token and refresh token for an user.
@spec has_password?(Mobilizon.Users.User.t()) :: boolean()
@spec login(String.t(), String.t()) :: {:ok, Mobilizon.Users.User.t()} | {:error, any()}