OAuth 2.0 Token Introspection (RFC 7662) and JWT-Secured Introspection Response (RFC 9701), as conn-free core.
Evaluates token activeness through Attesto.Introspection, applies
AttestoPhoenix.ProtectedResource.access_token_revoked?/2 to contained access
tokens, enforces the caller-authorization policy (RFC 7662 §2.2 and §4,
RFC 9701 §5), and optionally signs the RFC 9701 JWT response via
Attesto.SignedIntrospection.
Caller authorization
An active response is released only to a caller entitled to the token.
Without :introspection_authorize, the caller must be the client the token
was issued to (client_id) or be named in the token's aud. Any other
authenticated client, including one that registered itself through open
dynamic registration, receives %{"active" => false}. A protected resource
whose resource identifier is not its client_id is authorized through
:introspection_authorize, which replaces this default.
Summary
Types
RFC 7662 §2.2 introspection response map (always carries "active").
Functions
Extract the required "token" parameter from params.
Introspect token for authenticated client_id and return the RFC 7662
response map.
Sign an RFC 7662 introspection response map as an RFC 9701 JWT audienced to
client_id.
Types
@type response() :: Attesto.Introspection.response()
RFC 7662 §2.2 introspection response map (always carries "active").
Functions
@spec fetch_token(map()) :: {:ok, String.t()} | {:error, AttestoPhoenix.OAuthError.t()}
Extract the required "token" parameter from params.
@spec introspect( AttestoPhoenix.Config.t(), String.t() | nil, String.t(), String.t() | nil ) :: response()
Introspect token for authenticated client_id and return the RFC 7662
response map.
@spec sign_response(AttestoPhoenix.Config.t(), String.t(), response()) :: {:ok, String.t()}
Sign an RFC 7662 introspection response map as an RFC 9701 JWT audienced to
client_id.