Trot v0.7.0 Trot.AuthCheck View Source
Checks that a user has an authorized session before allowing them to access certain routes. By default, all routes are allowed.
Options
routes: List of URLs to check authorization on. Defaults to [].
match_fun: Function to run when a request matches the routes. Defaults to returning a 403.
match_default: Function to run when a request does not match any configured routes. Defaults to passing the connection through.
Example:
defmodule PiedPiper do
use Plug.Builder
plug Trot.AuthCheck, [routes: ["/secrets"]]
use Trot.AuthCheck
get "/marketing", do: "We are amazing, srsly you guys."
get "/secrets", do: "We're actually about to go bankrupt"
end
Link to this section Summary
Functions
Called when a route needs to be authenticated. Returns a 403 if there is no authentication, and passes the conn through untouched otherwise
Called when a given route is publicly accessible. This will simply pass the connection through to the next plug
Link to this section Functions
Called when a route needs to be authenticated. Returns a 403 if there is no authentication, and passes the conn through untouched otherwise.
Called when a given route is publicly accessible. This will simply pass the connection through to the next plug.