AuthShield v0.0.4 AuthShield.Authentication View Source
Implements a set of functions to deal with authentication requests.
Authentication is the process of determining whether someone or something is, in fact, who or what it declares itself to be, in other word it's the action of check if the user's credentials match the credentials in a database of authorized users or in a data authentication server.
Link to this section Summary
Types
Authentication possible responses
Functions
Gets an user password and calls AuthShield.Authentication.authenticate_password/3
to authenticates user given a password code.
Authenticates the user by password credential.
Gets an user pin and calls AuthShield.Authentication.authenticate_pin/3
to authenticates user given a pin code.
Authenticates the user by PIN credential.
Gets an user totp and calls AuthShield.Authentication.authenticate_totp/3
to authenticates user given a totp code.
Authenticates the user by TOTP credential.
Link to this section Types
responses()
View Sourceresponses() ::
{:ok, :authenticated} | {:error, :unauthenticated | :user_is_not_active}
Authentication possible responses
Link to this section Functions
authenticate_password(user, pass_code)
View Sourceauthenticate_password( user :: AuthShield.Resources.Schemas.User.t(), pass_code :: String.t() ) :: responses()
Gets an user password and calls AuthShield.Authentication.authenticate_password/3
to authenticates user given a password code.
Exemples:
AuthShield.Authentication.authenticate_password(user, "Mypass@rd23")
authenticate_password(user, pass, code)
View Sourceauthenticate_password( user :: AuthShield.Resources.Schemas.User.t(), password :: AuthShield.Credentials.Schemas.Password.t(), code :: String.t() ) :: responses()
Authenticates the user by password credential.
If the user is active and the password credential is right it will be authenticated, otherwiese ir returns an error.
Exemples:
AuthShield.Authentication.authenticate_password(user, password, "Mypass@rd23")
authenticate_pin(user, pin_code)
View Sourceauthenticate_pin( user :: AuthShield.Resources.Schemas.User.t(), pin_code :: String.t() ) :: responses()
Gets an user pin and calls AuthShield.Authentication.authenticate_pin/3
to authenticates user given a pin code.
Exemples:
AuthShield.Authentication.authenticate_pin(user, "332145")
authenticate_pin(user, pin, code)
View Sourceauthenticate_pin( user :: AuthShield.Resources.Schemas.User.t(), pin :: AuthShield.Credentials.Schemas.PIN.t(), pin_code :: String.t() ) :: responses()
Authenticates the user by PIN credential.
If the user is active and the pin credential is right it will be authenticated, otherwiese ir returns an error.
Exemples:
AuthShield.Authentication.authenticate_pin(user, "332145")
authenticate_totp(user, totp_code)
View Sourceauthenticate_totp( user :: AuthShield.Resources.Schemas.User.t(), totp_code :: String.t() ) :: responses()
Gets an user totp and calls AuthShield.Authentication.authenticate_totp/3
to authenticates user given a totp code.
Exemples:
AuthShield.Authentication.authenticate_totp(user, "332145")
authenticate_totp(user, totp, code)
View Sourceauthenticate_totp( user :: AuthShield.Resources.Schemas.User.t(), totp :: AuthShield.Credentials.Schemas.TOTP.t(), code :: String.t() ) :: responses()
Authenticates the user by TOTP credential.
If the user is active and the totp credential is right it will be authenticated, otherwiese ir returns an error.
Exemples:
AuthShield.Authentication.authenticate_totp(user, "332145")