Expand description
RFC 8693 token exchange: exchange an inbound NHI token for a backend-scoped token with narrowed scopes.
The exchange endpoint accepts a form-encoded request containing:
grant_type=urn:ietf:params:oauth:grant-type:token-exchangesubject_token— the inbound NHI JWTsubject_token_type=urn:ietf:params:oauth:token-type:jwtaudience— the target backend namescope— requested scopes (space-separated, optional)actor_token/actor_token_type— optional RFC 8693 §2.1 actor: a validated NHI token naming the agent that will act
The issued token preserves the original sub (human principal) and
records the acting agents in act, newest first. Without an actor
token, act.sub and azp are the subject token’s agent. With an actor
token, act.sub and azp are the actor’s agent and the subject’s
agent moves one level down (act.act.sub). Scopes are always an
intersection, never a union: requested ∩ subject, and additionally
∩ actor when an actor token is present.
Structs§
- Exchange
Actor - A validated RFC 8693 actor token.
- Exchange
Params - Parameters for building exchanged claims.
- Exchanged
Claims - Signed ancestry travels with exchanged tokens without trusting such claims in upstream NHI tokens. Each entry came from a verified delegation link.
- Exchanged
Validation - Trust and time settings for a token issued by this harness.
- Token
Exchange Request - Token exchange request (form-encoded body).
- Token
Exchange Response - Token exchange response.
Enums§
- Exchange
Error - Errors from the exchange process.
Constants§
- JWT_
TOKEN_ TYPE - RFC 8693 JWT token type.
- TOKEN_
EXCHANGE_ GRANT_ TYPE - RFC 8693 grant type.
Functions§
- build_
exchanged_ claims - Build exchanged claims from a validated subject token. The resulting
token preserves
sub(the human), adds a new link to theactchain, scopes to the intersection of requested and subject scopes, and narrows audience to the target backend. - build_
exchanged_ claims_ with_ actor build_exchanged_claimswith an optional RFC 8693 actor token. The actor must be an undelegated token; its scopes further narrow the result, its agent becomesact.subandazp, the subject’s agent becomesact.act.sub, and the delegation depth grows by two.- check_
exchanged_ revocation - Check a verified exchanged token in its separate namespace, then check every original identity against JTI and instance revocation rules.
- scope_
intersection - Compute the intersection of two scope sets, respecting wildcard rules. Returns only scopes that are covered by BOTH inputs.
- verify_
exchanged_ token - Verify a harness-issued token without reading revocation storage.