AuthShield v0.0.2 AuthShield.Authentication.Sessions View Source

Session is a temporary authentication information that is stored on server in order to keep the user logged in.

Link to this section Summary

Types

Transactional responses of failed

Transactional responses of success

Link to this section Types

Link to this type

failed_response()

View Source
failed_response() :: {:error, Ecto.Changeset.t()}

Transactional responses of failed

Link to this type

success_response()

View Source
success_response() :: {:ok, AuthShield.Authentication.Schemas.Session.t()}

Transactional responses of success

Link to this section Functions

Gets a AuthShield.Authentication.Schemas.Session register by its filters.

Exemples:

  AuthShield.Authentication.Sessions.get_by(user_id: "ecb4c67d-6380-4984-ae04-1563e885d59e")

Gets a AuthShield.Authentication.Schemas.Session register by its filters.

Similar to get_by/1 but returns the struct or raises if the changeset is invalid.

Creates a new AuthShield.Authentication.Schemas.Session register.

Exemples:

  AuthShield.Authentication.Sessions.insert(%{
    user_id: "ecb4c67d-6380-4984-ae04-1563e885d59e",
    remote_ip: "173.121.3.0",
    user_agent: "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0",
    expiration: ~U[2019-08-23 23:06:50.424629Z]
  })

Creates a new AuthShield.Authentication.Schemas.Session register.

Similar to insert/1 but returns the struct or raises if the changeset is invalid.

Checks if the give AuthShield.Authentication.Schemas.Session is expired

Exemples:

  AuthShield.Authentication.Sessions.is_expired?(session)

Returns a list of AuthShield.Authentication.Schemas.Session by its filters

Exemples:

  # Getting the all list
  AuthShield.Authentication.Sessions.list()

  # Filtering the list by field
  AuthShield.Authentication.Sessions.list(user_id: "ecb4c67d-6380-4984-ae04-1563e885d59e")

Updates a AuthShield.Authentication.Schemas.Session register.

Exemples:

  AuthShield.Authentication.Sessions.update(session, %{expiration: ~U[2019-08-30 23:06:50.424629Z]})

Updates a AuthShield.Authentication.Schemas.Session register.

Similar to update/2 but returns the struct or raises if the changeset is invalid.