View Source Guardian.Token.Jwt.SecretFetcher behaviour (Guardian v2.3.2)

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_signing_secret fetches the secret to sign.

Fetches the secret to verify a token.

Link to this section Callbacks

Link to this callback

fetch_signing_secret(module, opts)

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

fetch_signing_secret fetches the secret to sign.

Link to this callback

fetch_verifying_secret(module, token_headers, opts)

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

Fetches the secret to verify a token.

It is provided with the tokens headers in order to lookup the secret.