doorman v0.0.4 Doorman.Login behaviour
This module provides boilerplate for creating Plugs for authentication with Doorman.
Modules that use Doorman.Login
should implement a get_current_user/1
function that accepts a connection and returns either the current user, or
nil.
Those modules should also implement helper functions such as login, logout, and etc. when applicable.
Example
defmodule MyApp.Auth do
use Doorman.Login
defp get_current_user(conn) do
MyApp.Repo.get(MyApp.User, 1)
end
end
Under the hood Doorman.Login
implements the callbacks for the Plug
behaviour. Both init/1
and call/2
are overridable.
Summary
Callbacks
Returns either the current user or nil based on the state of the passed in
conn