Expand description
Purpose-bound claim validation — a faithful port of auth_service’s
crypto/jwt.rs ValidationPolicy/TokenPurpose/validate_claims so
consumers apply exactly the contract the issuer enforces.
Semantics mirrored from backends/rust/auth_service/src/crypto/jwt.rs:
- trusted_issuers: exact-match allow-list; empty = no issuer pinning.
A pinned policy requires a nonblank string
issin that allow-list. Issuer-less compatibility requires an explicitly unpinned raw policy. - expected_audiences: empty = unpinned; non-empty requires the token’s
aud(string or array) to intersect the expected set. - purpose binds the
typeclaim + required claims (sub/exp/iat,iss/aud/auth_timefor ID tokens,sub == client_idfor internal assertions).
WP-05a adds the RFC 9068 §2.1 JOSE typ check layered on top:
ValidationPolicy::require_at_jwt (default on for access purposes)
demands a typ header of at+jwt (or the media-type form
application/at+jwt), which auth_service mints on every access token
since WP-03b. allow_legacy_typ() opens the compat window for tokens
minted before the profile landed.
Structs§
- Validation
Policy - Claim-level validation applied after signature verification.
Enums§
- Token
Purpose - The purpose a validated credential must serve (mirrors
TokenPurpose).
Functions§
- is_
at_ jwt_ typ - Returns true when the JOSE
typheader names the RFC 9068 profile.typcompares case-insensitively as a media type;application/at+jwtis the explicit-registration equivalent ofat+jwt. - validate_
claims - Bind a verified claim set to its purpose: exact
type, required claims, issuer allow-list, audience allow-list. Byte-for-byte port of the service’svalidate_claims. - validate_
typ_ header - Check the JOSE
typheader for the policy’s purpose. Call before signature verification — a wrongtypmeans the token is not even the right credential class.