View Source CloudflareAccessEx.Plug (cloudflare_access_ex v0.1.4)
This plug is responsible for blocking requets that do not have a valid Cloudflare Access application token.
Examples
plug CloudflareAccessEx.Plug, cfa_app: :my_cfa_app
To allow anonymous tokens, use the following:
plug CloudflareAccessEx.Plug, cfa_app: :my_cfa_app, allow_anonymous: true
Summary
Functions
Verifies the Cloudflare Access application token.
Returns the principal. Will raise if executed on a request that has not passed through the plug or if the plug has rejected the request.
Functions
Verifies the Cloudflare Access application token.
It will reject the request with 403 (Forbidden) if the token is invalid or if the token is anonymous and anonymous access is not allowed.
If the token is valid, the principal will be set in the conn's private map
and can be accessed via CloudflareAccessEx.Plug.get_principal/1
.
@spec get_principal(Plug.Conn.t()) :: CloudflareAccessEx.Principal.t()
Returns the principal. Will raise if executed on a request that has not passed through the plug or if the plug has rejected the request.