curator v0.2.3 Curator.Guardian.Token.Opaque View Source
Opaque token implementation for Guardian.
Rather than the default JWT implementation, this module expect that a token will be an opaque string, that can be looked up (in a persistance module) to get the claims. It uses a subset of the standard JWT claims so it will function as a drop-in replacement for the default Guardian implementation.
NOTE: To use this module, the guardian implementation module must implement get_token, create_token & delete_token (the Curator.Guardian.Token.Opaque.Persistence behaviour). An example can be found in the specs (it uses a context and an ecto repo). Redis, Genserver, or other stateful implementations can also be used.
Link to this section Summary
Functions
Builds the default claims (a subset of the JWT claims)
Create a token. Uses the claims, and persists the token. Returns the token
Find the token and return its claims (or return an error)
Exchange a token of one type to another (not applicable but a required behaviour)
Inspect the token
Refresh the token (not applicable but a required behaviour)
Delete the token
Generate unique token id
Verifies the claims (not applicable but a required behaviour)
Link to this section Functions
Builds the default claims (a subset of the JWT claims).
By default, only typ, and sub are used
Options:
Options may override the defaults found in the configuration.
token_type
- Override the default token type
Create a token. Uses the claims, and persists the token. Returns the token
Find the token and return its claims (or return an error)
Exchange a token of one type to another (not applicable but a required behaviour).
It will return an error if called
Inspect the token.
Return a map with keys: claims
Refresh the token (not applicable but a required behaviour)
It will return an error if called
Delete the token
Generate unique token id
Verifies the claims (not applicable but a required behaviour).