feat/p3.5-token-exchange
main
Closes homelab#10 (P3.5)
POST /auth/exchange — RFC 8693-inspired token exchange.
POST /auth/exchange
subject_token
client_credentials
scope
{"subject_token": "<user JWT>", "client_id": "portfolio-agent", "client_secret": "<secret>", "scope": "memory:read", "resource": "poimen-memory"}
{"access_token": "<service JWT>", "subject": "user-hash", "acting_party": "portfolio-agent", "scope": "memory:read"}
14 tests: scope subset logic, JWT payload extraction, missing fields, invalid JSON, wrong method, not configured, scope escalation denial, claim helpers.
POST /auth/exchange: service presents user JWT + own credentials, gets scoped service token with subject identity metadata. Flow: validate subject token, authenticate service via client_credentials, verify scope subset, return token + metadata. Scope escalation denied if requested scope exceeds service roles. 14 tests covering: helpers, validation, missing fields, scope subset, JWT decoding, edge cases. Closes homelab#10 Co-authored-by: poimen <[email protected]>
No dependencies set.
The note is not visible to the blocked user.
Closes homelab#10 (P3.5)
Endpoint
POST /auth/exchange— RFC 8693-inspired token exchange.Flow
subject_token(user JWT) via gateway's JWKS validatorclient_credentialsagainst Authentikscopeis subset of service's roles (deny escalation)Request
Response
Tests
14 tests: scope subset logic, JWT payload extraction, missing fields, invalid JSON, wrong method, not configured, scope escalation denial, claim helpers.