AuthShield v0.0.2 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

Link to this section Types

Link to this type

responses()

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

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()

Authenticates the user by password credential.

If the user is active and the password credentials are right it will return {:ok, :authenticated} otherwiese {:error, :unauthorized}.

Exemples:

  AuthShield.Authentication.authenticate_password(user, "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()

Authenticates the user by PIN credential.

If the user is active and the password credentials are right it will return {:ok, :authenticated} otherwiese {:error, :unauthorized}.

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()

Authenticates the user by TOTP credential.

If the user is active and the password credentials are right it will return {:ok, :authenticated} otherwiese {:error, :unauthorized}.

Exemples:

  AuthShield.Authentication.authenticate_totp(user, "332145")

See AuthShield.Authentication.Sessions.insert/1.

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

See AuthShield.Authentication.Sessions.get_by/1.

See AuthShield.Authentication.Sessions.get_by!/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.