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

Link to this type

responses()

View Source
responses() ::
  {:ok, :authenticated} | {:error, :unauthenticated | :user_is_not_active}

Authentication possible responses

Link to this section Functions

Link to this function

authenticate_password(user, pass_code)

View Source
authenticate_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")
Link to this function

authenticate_password(user, pass, code)

View Source
authenticate_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")
Link to this function

authenticate_pin(user, pin_code)

View Source
authenticate_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")
Link to this function

authenticate_pin(user, pin, code)

View Source
authenticate_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")
Link to this function

authenticate_totp(user, totp_code)

View Source
authenticate_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")
Link to this function

authenticate_totp(user, totp, code)

View Source
authenticate_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")
Link to this function

create_login_attempt(params)

View Source

See AuthShield.Authentication.LoginAttempts.insert/1.

Link to this function

create_login_attempt!(params)

View Source

See AuthShield.Authentication.LoginAttempts.insert!/1.

See AuthShield.Authentication.Sessions.insert/1.

See AuthShield.Authentication.Sessions.insert!/1.

Link to this function

get_login_attempt_by(params)

View Source

See AuthShield.Authentication.LoginAttempts.get_by/1.

Link to this function

get_login_attempt_by!(params)

View Source

See AuthShield.Authentication.LoginAttempts.get_by!/1.

See AuthShield.Authentication.Sessions.get_by/1.

See AuthShield.Authentication.Sessions.get_by!/1.

Link to this function

list_failure_login_attempts(user, from_date)

View Source

See AuthShield.Authentication.LoginAttempts.list_failure/2.

Link to this function

list_login_attempt(filters)

View Source

See AuthShield.Authentication.LoginAttempts.list/1.

See AuthShield.Authentication.Sessions.list/1.

Link to this function

update_session(session, params)

View Source

See AuthShield.Authentication.Sessions.update/2.

Link to this function

update_session!(session, params)

View Source

See AuthShield.Authentication.Sessions.update!/2.