Pow v1.0.15 Pow.Plug.Base behaviour View Source
This plug macro will set :pow_config
as private, and attempt to fetch and
assign a user in the connection if it has not already been assigned. The user
will be assigned automatically in any of the operations.
Example
defmodule MyAppWeb.Pow.CustomPlug do
use Pow.Plug.Base
@impl true
def fetch(conn, _config) do
user = fetch_user_from_cookie(conn)
{conn, user}
end
@impl true
def create(conn, user, _config) do
conn = update_cookie(conn, user)
{conn, user}
end
@impl true
def delete(conn, _config) do
delete_cookie(conn)
end
end
Link to this section Summary
Link to this section Callbacks
Link to this callback
call(arg1, arg2)
View Sourcecall(Plug.Conn.t(), Pow.Config.t()) :: Plug.Conn.t()
Link to this callback
create(arg1, map, arg3)
View Sourcecreate(Plug.Conn.t(), map(), Pow.Config.t()) :: {Plug.Conn.t(), map()}
Link to this callback
delete(arg1, arg2)
View Sourcedelete(Plug.Conn.t(), Pow.Config.t()) :: Plug.Conn.t()
Link to this callback
fetch(arg1, arg2)
View Sourcefetch(Plug.Conn.t(), Pow.Config.t()) :: {Plug.Conn.t(), map() | nil}