Skip to main content

Module jwt

Module jwt 

Source
Expand description

JWT verification via JWKS with TTL cache + bounded kid-miss refresh. Mirrors src/crypto/jwt.rs (RS256, exp/iat/type, kid header), the ValidationPolicy surface from crate::policy, and the RFC 9068 §2.1 at+jwt JOSE typ check auth_service mints on every access token (WP-03b).

MultiIssuerVerifier (R-21.2) is the engine: an explicit issuer allow-list is checked against the token’s iss BEFORE any JWKS fetch, every listed issuer has its own JWKS cache, the verification algorithm comes from the key (never the token header), and a kid miss triggers one refresh that is rate-limited per issuer, so a flood of unknown kids (or of tokens from unlisted issuers) cannot drive unbounded fetches. Verifier is the single-issuer wrapper over it and keeps the original API.

Structs§

Claims
CurrentUser
Verified identity from an access token.
IssuerConfig
One allow-listed issuer. jwks_uri overrides the default <issuer>/.well-known/jwks.json (set it from discovery).
LogoutTokenOptions
What MultiIssuerVerifier::verify_logout_token needs besides the token.
MultiIssuerVerifier
Kid-aware JWKS verifier over an explicit issuer allow-list. The production surface: verify enforces the RFC 9068 at+jwt profile, the issuer allow-list and the configured audience; verify_claims takes an explicit ValidationPolicy matching auth_service’s decode_with_policy semantics exactly.
Verifier
Single-issuer verifier: the original API, as a one-issuer MultiIssuerVerifier. The issuer and audience pins are required; a blank one fails closed at verification time, before any network call.

Constants§

DEFAULT_MIN_FETCH_INTERVAL
Default minimum interval between JWKS fetch attempts, kept per issuer. Bounds the kid-miss refetch path so a forged kid cannot drive a fetch loop — mirrors jose’s cooldownDuration contract. Duration::ZERO disables it (tests, and verifiers pinned to a static JWKS).

Functions§

create_multi_issuer_verifier
create_verifier
generate_code_challenge
generate_code_verifier
PKCE helpers (S256, 43-char unpadded base64url)

Type Aliases§

ConsumeJti
Replay protection for logout tokens: called once with (jti, expires_at) after every other check passed; return false when that jti was seen before.