Guardian v1.1.0 Guardian.Token.Jwt.SecretFetcher behaviour View Source

Provides a behaviour that specifies how to fetch the secret for the token

use Guardian.Token.JWT.SecretFetcher to provide default implementations of each function

Link to this section Summary

Callbacks

fetch_siginig_secret fetches the secret to sign

fetch_verifying_secret fetches the secret to verify a token. It is provided with the tokens headers in order to lookup the secret

Link to this section Callbacks

Link to this callback fetch_signing_secret(module, opts) View Source
fetch_signing_secret(module(), opts :: Guardian.options()) ::
  {:ok, term()} |
  {:error, :secret_not_found}

fetch_siginig_secret fetches the secret to sign.

Link to this callback fetch_verifying_secret(module, token_headers, opts) View Source
fetch_verifying_secret(module(), token_headers :: map(), opts :: Guardian.options()) ::
  {:ok, term()} |
  {:error, :secret_not_found}

fetch_verifying_secret fetches the secret to verify a token. It is provided with the tokens headers in order to lookup the secret.