P3.5: Implement RFC 8693 OAuth2 Token Exchange endpoint #10

Open
opened 2026-09-08 04:42:06 +00:00 by rock · 0 comments
Owner

Summary

POST /auth/exchange — service presents user JWT + own credentials, gets scoped token for downstream with both identities.

Code repo: rock/homelab-frontend

Request

grant_type=urn:ietf:params:oauth:grant-type:token-exchange
subject_token=<user JWT>
subject_token_type=urn:ietf:params:oauth:token-type:access_token
client_id=portfolio-agent
client_secret=<service secret>
scope=memory:read
resource=poimen-memory

Response JWT claims

{
  "sub": "rock",
  "azp": "portfolio-agent",
  "act": {"sub": "portfolio-agent"},
  "roles": ["memory:read"],
  "aud": "poimen-memory"
}

Investigation needed

  • Does Authentik support RFC 8693 natively?
  • If no: gateway-minted tokens with own signing key

Acceptance Criteria

  • New token has act claim (RFC 8693 actor)
  • Scope cannot escalate (subset of actor roles only)
  • Subject token expiry checked before exchange
  • Exchanged token has shorter TTL than subject
  • Audit log entry for every exchange

Depends on

  • P3.2, P3.4
## Summary `POST /auth/exchange` — service presents user JWT + own credentials, gets scoped token for downstream with both identities. **Code repo:** `rock/homelab-frontend` ## Request ``` grant_type=urn:ietf:params:oauth:grant-type:token-exchange subject_token=<user JWT> subject_token_type=urn:ietf:params:oauth:token-type:access_token client_id=portfolio-agent client_secret=<service secret> scope=memory:read resource=poimen-memory ``` ## Response JWT claims ```json { "sub": "rock", "azp": "portfolio-agent", "act": {"sub": "portfolio-agent"}, "roles": ["memory:read"], "aud": "poimen-memory" } ``` ## Investigation needed - [ ] Does Authentik support RFC 8693 natively? - [ ] If no: gateway-minted tokens with own signing key ## Acceptance Criteria - [ ] New token has `act` claim (RFC 8693 actor) - [ ] Scope cannot escalate (subset of actor roles only) - [ ] Subject token expiry checked before exchange - [ ] Exchanged token has shorter TTL than subject - [ ] Audit log entry for every exchange ## Depends on - P3.2, P3.4
rock added this to the Phase 3: OAuth2 Token Exchange & Identity Propagation milestone 2026-09-08 04:42:06 +00:00
rock self-assigned this 2026-09-08 04:42:09 +00:00
rock added this to the API-GW OAuth project 2026-09-08 04:43:58 +00:00
Sign in to join this conversation.