BtrzAuth v0.10.1 BtrzAuth.Plug.VerifyPremium View Source
Looks for and validates that the passed keys
features are present in the saved claims under conn.private
using BtrzAuth.Guardian.Plug.current_claims(conn)
.
This, like all other Guardian plugs, requires a Guardian pipeline to be setup.
It requires an error handler as error_handler
.
These can be set either:
- Upstream on the connection with
plug Guardian.Pipeline
- Upstream on the connection with
Guardian.Pipeline.{put_module, put_error_handler, put_key}
- Inline with an option of
:module
,:error_handler
,:key
If the claims are not found, the pipeline will be halted and the error handler will be called with
auth_error(conn, {:premium_not_verified, reason}, opts)
Options:
keys
- list of atom premium features to verify. Defaults to:[]
Example
plug BtrzAuth.Plug.VerifyPremium, keys: [:special_content]
Link to this section Summary
Link to this section Functions
Link to this function
call(conn, opts)
View Source
call(Plug.Conn.t(), Keyword.t()) :: Plug.Conn.t()