Pow v1.0.12 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 Source
call(arg1, arg2)
View Source
call(Plug.Conn.t(), Pow.Config.t()) :: Plug.Conn.t()
call(Plug.Conn.t(), Pow.Config.t()) :: Plug.Conn.t()
Link to this callback
create(arg1, map, arg3)
View Source
create(arg1, map, arg3)
View Source
create(Plug.Conn.t(), map(), Pow.Config.t()) :: {Plug.Conn.t(), map()}
create(Plug.Conn.t(), map(), Pow.Config.t()) :: {Plug.Conn.t(), map()}
Link to this callback
delete(arg1, arg2)
View Source
delete(arg1, arg2)
View Source
delete(Plug.Conn.t(), Pow.Config.t()) :: Plug.Conn.t()
delete(Plug.Conn.t(), Pow.Config.t()) :: Plug.Conn.t()
Link to this callback
fetch(arg1, arg2)
View Source
fetch(arg1, arg2)
View Source
fetch(Plug.Conn.t(), Pow.Config.t()) :: {Plug.Conn.t(), map() | nil}
fetch(Plug.Conn.t(), Pow.Config.t()) :: {Plug.Conn.t(), map() | nil}
Link to this callback
init(arg1)
View Source
init(arg1)
View Source
init(Pow.Config.t()) :: Pow.Config.t()
init(Pow.Config.t()) :: Pow.Config.t()