RIG.JWT behaviour (Reactive Interaction Gateway v3.0.0-alpha.2) View Source
JSON Web Token handling.
Link to this section Summary
Types
Turns claims into errors for blacklisted JWTs.
Functions
Returns module configuration.
Callbacks
Find JWT claims in one or more HTTP headers.
Extract claims from a given encoded JWT.
Checks an encoded JWT for validity.
Link to this section Types
Specs
Specs
claims_and_errors() :: [validation_result()]
Specs
ensure_not_blacklisted() :: (claims() -> validation_result())
Turns claims into errors for blacklisted JWTs.
Specs
http_header() :: {http_header_name :: String.t(), http_header_value()}
Specs
http_header_value() :: String.t()
Specs
http_headers() :: [http_header()]
Specs
Specs
token() :: String.t()
Specs
Link to this section Functions
Specs
config() :: any()
Returns module configuration.
If application environment contains values in Keyword
or Map
struct,
defaults from macro usage will be recursively merged with application configuration.
If one of the configuration parameters does not exist or can not be resolved, raises ArgumentError
.
Specs
parse_http_header(http_headers, jwt_conf \\ config().jwt_conf, ensure_not_blacklisted \\ &ensure_not_blacklisted/1)
View Sourceparse_token(token, jwt_conf \\ config().jwt_conf, ensure_not_blacklisted \\ &ensure_not_blacklisted/1)
View Sourcevalid?(token, jwt_conf \\ config().jwt_conf, ensure_not_blacklisted \\ &ensure_not_blacklisted/1)
View SourceLink to this section Callbacks
Specs
parse_http_header( http_header_value() | http_headers(), jwt_conf(), ensure_not_blacklisted() ) :: claims_and_errors()
Find JWT claims in one or more HTTP headers.
All "Authorization" headers are considered. A single header may contain one or more credentials. Only "Bearer"-type (scheme) credentials are interpreted as JSON Web Tokens. Each of those JWTs is validated using their signature. The result contains JWT claims for successfully validated tokens and errors where the validation failed.
Specs
parse_token(token(), jwt_conf(), ensure_not_blacklisted()) :: validation_result()
Extract claims from a given encoded JWT.
Specs
valid?(token(), jwt_conf(), ensure_not_blacklisted()) :: boolean()
Checks an encoded JWT for validity.