mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-19 00:01:29 +00:00
fix: token exchange support
This commit is contained in:
parent
4ebb7bb890
commit
8caa4da357
3 changed files with 8 additions and 0 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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."""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue