Skip to main content

require_bearer_token

Function require_bearer_token 

Source
pub async fn require_bearer_token(
    __arg0: State<Arc<OAuthState>>,
    request: Request,
    next: Next,
) -> Response
Expand description

Require a valid Bearer or DPoP token on the request.

Routes JWT verification by the protected alg header, then validates the exact OAuth-self audience and one of this node’s exact profile issuers. When Authorization: DPoP is used, also verifies the DPoP proof header and checks that cnf.jkt in the token matches the proof key’s thumbprint. Inserts AuthenticatedUser into request extensions on success. Returns 401 if the token is absent, expired, or has an invalid signature.