fix: token exchange support

This commit is contained in:
Yassin Kortam 2026-06-11 17:23:10 -07:00
parent 4ebb7bb890
commit 8caa4da357
3 changed files with 8 additions and 0 deletions

View file

@ -87,6 +87,7 @@ class OAuth2Authenticator(Authenticator):
audience=token_audience,
scopes=split_scope(body.get("scope")),
claims=claims,
subject_token=token,
)
def challenge(self) -> str:

View file

@ -66,6 +66,7 @@ def credential_from_claims(
scopes=split_scope(claims.get("scope")),
claims=claims,
credential_ref=CredentialRef(key_id=header.get("kid"), token_id=claims.get("jti")),
subject_token=token,
)

View file

@ -97,6 +97,12 @@ class Credential(BaseModel):
credential_ref: CredentialRef = Field(default_factory=CredentialRef)
client_certificate: Optional[ClientCertificate] = None
# Raw bearer/access token as presented by the caller, retained so it can be
# used as the subject_token for downstream token exchange (RFC 8693) when
# calling LLM providers or MCP servers on the caller's behalf. None for
# schemes without an exchangeable token (API key, HTTP basic, mTLS).
subject_token: Optional[str] = None
class Principal(BaseModel):
"""Normalized caller identity. Identity only, no policy/budget state."""