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:

  1. Upstream on the connection with plug Guardian.Pipeline
  2. Upstream on the connection with Guardian.Pipeline.{put_module, put_error_handler, put_key}
  3. 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