View Source Assent.JWTAdapter behaviour (Assent v0.3.0)
JWT adapter helper module.
You can configure the JWT adapter by updating the configuration:
jwt_adapter: {Assent.JWTAdapter.AssentJWT, [...]}
Default options can be set by passing a list of options:
jwt_adapter: {Assent.JWTAdapter.AssentJWT, [...]}
You can also set global application config:
config :assent, :jwt_adapter, Assent.JWTAdapter.AssentJWT
Usage
defmodule MyApp.MyJWTAdapter do
@behaviour Assent.JWTAdapter
@impl true
def sign(claims, alg, secret, opts) do
# ...
end
@impl true
def verify(token, secret, opts) do
# ...
end
end
Summary
Functions
Loads a private key from the provided configuration.
Generates a signed JSON Web Token signature.
Verifies the JSON Web Token signature.
Callbacks
Functions
Loads a private key from the provided configuration.
Options
:private_key_path
- The path to the private key file, optional.:private_key
- The private key, required if:private_key_path
is not set.
Generates a signed JSON Web Token signature.
Options
:json_library
- The JSON library to use, optional, seeAssent.json_library/1
.:jwt_adapter
- The JWT adapter module to use, optional, defaults toAssent.JWTAdapter.AssentJWT
Verifies the JSON Web Token signature.
Options
:json_library
- The JSON library to use, optional, seeAssent.json_library/1
.:jwt_adapter
- The JWT adapter module to use, optional, defaults toAssent.JWTAdapter.AssentJWT