Joken Signer Config v0.1.0 Joken.Signer.Config View Source
Joken Signer Config is used to derive an appropriate %Joken.Signer
from a jwt token
based on the criteria of one or many %Joken.Signer.Config
s within a list
How it works
Given a list of %Joken.Signer.Config
s that look like this
[
%Joken.Signer.Config{
claims: %{ iss: "some_issuer" }
headers: %{ alg: hs256 },
signer: &Joken.h256/1
},
#...more Signer Configs
]
and a jwt token with contents like this
Link to this section Summary
Functions
Combines &peek/1
and &peek_header/1
to give a map
that includes both headers and claims from the token
Link to this section Types
Link to this type
t()
View Source
t() :: %Joken.Signer.Config{ claims: claims(), headers: headers(), signer: (... -> Joken.Signer.t()) }
Link to this section Functions
Combines &peek/1
and &peek_header/1
to give a map
that includes both headers and claims from the token
Examples
iex> my_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSm9obiBEb2UifQ.DjwRE2jZhren2Wt37t5hlVru6Myq4AhpGLiiefF69u8"
iex> import Joken.Signer.Config
iex> peek_headers_and_claims(my_token)
%{
claims: %{"name" => "John Doe"},
headers: %{"alg" => "HS256", "typ" => "JWT"}
}