AuthShield v0.0.1 AuthShield View Source
Elixir authentication and authorization framework
Link to this section Summary
Functions
Login the user by its password credential.
Logout the authenticated user session.
Refresh the authenticated user session.
Creates a new user on the system.
Link to this section Functions
login(params, opts \\ [])
View Sourcelogin(params :: AuthShield.Validations.Login.t(), opts :: keyword()) :: {:ok, AuthShield.Authentication.Schemas.Session.t()} | {:error, :user_not_found} | {:error, :unauthenticated} | {:error, Ecto.Changeset.t()} | {:error, map()}
Login the user by its password credential.
If the user and its credential is authenticated it will return {:ok, AuthShield.Authentication.Schemas.Session.t()}
.
This session should be stored and used on authentication to keep users logged.
Exemples:
AuthShield.login(
"lucas@gmail.com",
"Mypass@rd23",
remote_ip: "172.31.4.1",
user_agent: "Mozilla/5.0 (Windows NT x.y; rv:10.0) Gecko/20100101 Firefox/10.0"
)
logout(session_id)
View Sourcelogout(session_id :: String.t()) :: {:ok, AuthShield.Authentication.Schemas.Session.t()} | {:error, :session_not_exist} | {:error, Ecto.Changeset.t()}
Logout the authenticated user session.
If the user is authenticated and has an active session it will
return {:ok, AuthShield.Authentication.Schemas.Session.t()}
.
This session can be ignored because use is not active anymore.
Exemples:
AuthShield.logout("ecb4c67d-6380-4984-ae04-1563e885d59e")
refresh_session(session_id)
View Sourcerefresh_session( session_id :: String.t() | AuthShield.Authentication.Schemas.Session.t() ) :: {:ok, AuthShield.Authentication.Schemas.Session.t()} | {:error, :session_expired} | {:error, :session_not_exist} | {:error, Ecto.Changeset.t()}
Refresh the authenticated user session.
If the user is authenticated and has an active session it will
return {:ok, AuthShield.Authentication.Schemas.Session.t()}
.
This session should be stored and used on authentication to keep users logged.
Exemples:
AuthShield.refresh_session("ecb4c67d-6380-4984-ae04-1563e885d59e")
signup(params)
View Sourcesignup(params :: AuthShield.Validations.SignUp.t()) :: {:ok, AuthShield.Resources.Schemas.User.t()} | {:error, map()} | {:error, Ecto.Changeset.t()}
Creates a new user on the system.
Exemples:
AuthShield.signup(%{
first_name: "Lucas",
last_name: "Mesquita",
email: "lucas@gmail.com",
password: "My_passw@rd2"}
})