View Source PrimaAuth0Ex.Token (prima_auth0_ex v0.3.0)

Module to verify the integrity and validate the claims of tokens.

Link to this section Summary

Link to this section Functions

Link to this function

generate_and_sign(extra_claims \\ %{}, key \\ __default_signer__())

View Source

Specs

generate_and_sign(Joken.claims(), Joken.signer_arg()) ::
  {:ok, Joken.bearer_token(), Joken.claims()} | {:error, Joken.error_reason()}

Combines generate_claims/1 and encode_and_sign/2

Link to this function

generate_and_sign!(extra_claims \\ %{}, key \\ __default_signer__())

View Source

Specs

generate_and_sign!(Joken.claims(), Joken.signer_arg()) :: Joken.bearer_token()

Same as generate_and_sign/2 but raises if error

Specs

peek_permissions(String.t()) :: [String.t()]

Returns the list of permissions held by a token.

In case of missing permissions claim or malformed token it defaults to an empty list. Note that this function does not verify the signature of the token.

Link to this function

verify_and_validate(bearer_token, key \\ __default_signer__(), context \\ %{})

View Source

Specs

verify_and_validate(Joken.bearer_token(), Joken.signer_arg(), term()) ::
  {:ok, Joken.claims()} | {:error, Joken.error_reason()}

Combines verify/2 and validate/2

Link to this function

verify_and_validate!(bearer_token, key \\ __default_signer__(), context \\ %{})

View Source

Specs

verify_and_validate!(Joken.bearer_token(), Joken.signer_arg(), term()) ::
  Joken.claims()

Same as verify_and_validate/2 but raises if error

Link to this function

verify_and_validate_token(token, audience, required_permissions, ignore_signature)

View Source

Specs

verify_and_validate_token(String.t(), String.t(), [String.t()], boolean()) ::
  {:ok, Joken.claims()} | {:error, atom() | Keyword.t()}