A refusal of a request. It becomes an HTTP status and a
WWW-Authenticate header value.
Summary
Functions
The key of the internal error table of the context for the challenge.
Turn the shortcut atoms that the authenticate/2 contract allows into
a challenge and check a challenge: an unknown error, a description
that is not a string or nil and scopes that are not a list of scope
tokens are defects of the verifier. Any such value raises
ArgumentError and the caller must answer a server error, never a
pass.
Build the WWW-Authenticate value of the challenge.
The token is valid but misses scopes. HTTP 403. Raises ArgumentError
when a scope does not match the RFC 6749 scope-token syntax, when the
scopes are not a list, or when the description is neither a string nor
nil.
The request is malformed. HTTP 400. Raises ArgumentError when the
description is neither a string nor nil.
The bearer token is not valid. HTTP 401. Raises ArgumentError when
the description is neither a string nor nil.
The request carries no usable bearer credential. HTTP 401 without an error parameter (RFC 6750, section 3.1).
Types
Functions
@spec error_code(t()) :: :http_unauthorized | :http_bad_authorization | :http_insufficient_scope
The key of the internal error table of the context for the challenge.
Turn the shortcut atoms that the authenticate/2 contract allows into
a challenge and check a challenge: an unknown error, a description
that is not a string or nil and scopes that are not a list of scope
tokens are defects of the verifier. Any such value raises
ArgumentError and the caller must answer a server error, never a
pass.
Build the WWW-Authenticate value of the challenge.
metadata_url is the Protected Resource Metadata URL of the server.
default_scopes are used when the challenge holds no scopes of its
own. The description is cut to 200 characters. Each
character that the header cannot hold becomes ?.
The token is valid but misses scopes. HTTP 403. Raises ArgumentError
when a scope does not match the RFC 6749 scope-token syntax, when the
scopes are not a list, or when the description is neither a string nor
nil.
The request is malformed. HTTP 400. Raises ArgumentError when the
description is neither a string nor nil.
The bearer token is not valid. HTTP 401. Raises ArgumentError when
the description is neither a string nor nil.
@spec missing_token() :: t()
The request carries no usable bearer credential. HTTP 401 without an error parameter (RFC 6750, section 3.1).