doorman v0.0.4 Doorman.RequireLogin

A plug that ensures the user is authenticated.

This plug accepts a handler function when used that is called when a user is unauthenticated. This function receives conn and should return Plug.Conn.halt/1.

The default handler sets the status code to 422 and halts.

Example

plug Doorman.RequireLogin, &require_login/1

defp require_login(conn) do
  conn
  |> redirect(to: session_path(conn, :new))
  |> Plug.Conn.halt
end

Summary

Functions

Callback implementation for c:Plug.call/2

Callback implementation for c:Plug.init/1

Functions

call(conn, unauthenticated_handler \\ &stop/1)

Callback implementation for c:Plug.call/2.

init(unauthenticated_handler \\ &stop/1)

Callback implementation for c:Plug.init/1.