PhoenixCap.RequireToken (PhoenixCap v0.1.0)

Copy Markdown View Source

Requires a valid cap-token request parameter. A successful check consumes the token and continues the pipeline. A failed check sends HTTP 422 and halts.

Controllers can install this plug using use PhoenixCap. The optional :only list selects Phoenix controller actions by name.

Summary

Functions

Checks the parsed top-level cap-token parameter before a protected action runs.

Selects all controller actions by default, or the actions named in :only.

Functions

call(conn, actions)

@spec call(Plug.Conn.t(), :all | [atom()]) :: Plug.Conn.t()

Checks the parsed top-level cap-token parameter before a protected action runs.

init(opts)

@spec init(keyword()) :: :all | [atom()]

Selects all controller actions by default, or the actions named in :only.