Expand description
JWT mint extension.
Replaces the legacy TokenClaimsExtender trait in yeti-auth.
Plugins that want to add extra claims to issued JWTs (an Okta
plugin embedding groups[], an Azure AD plugin embedding
appRoles[], etc.) register a
tower::Service<TokenRequest, Response = TokenResponse>.
The host runs the registered pipeline as part of every JWT mint
(login, magic-link consume, refresh). Each plugin’s Service
returns a (possibly modified) TokenResponse; the next plugin
receives that response as its input.
The actual JwtClaims type lives in yeti-auth::auth_types. To
keep yeti-types zero-dep on yeti crates (per the crate’s
own README), this module uses serde_json::Value as the on-the-
wire representation. Adapter glue in yeti-auth converts to/from
the typed JwtClaims.
Structs§
- Token
Request - Input to the token-mint pipeline. Carries the username being minted for, the apps the token will be scoped to, and a place for plugins to drop extra claims.
Constants§
- TOKEN_
HOOK_ CHAIN_ NAME - Versioned hook chain name for JWT mint extension services
(ADR-009). See
super::oauth::OAUTH_HOOK_CHAIN_NAMEfor the rationale behind placing the constant here.
Type Aliases§
- Token
Response - Output of the token-mint pipeline — the (possibly mutated)
TokenRequestready to be folded back into the canonicalJwtClaimsand signed. - Token
Service - Tower-shaped JWT-mint extension service. Plugins register
BoxCloneSyncService::new(service_fn(...))against this type; yeti-auth chains every registered service per JWT mint, threading theTokenRequest(with itsextraclaims accumulator) through each in turn before signing.