build(schema.prisma): add new sso_user_id to LiteLLM_UserTable (#8167)

* build(schema.prisma): add new `sso_user_id` to LiteLLM_UserTable

easier way to store sso id for existing user

Allows existing user added to team, to login via SSO

* test(test_auth_checks.py): add unit testing for fuzzy user object get

* fix(handle_jwt.py): fix merge conflicts
This commit is contained in:
Krish Dholakia 2025-01-31 23:04:05 -08:00 committed by GitHub
parent 2147cad307
commit 8d0db8b379
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 144 additions and 3 deletions

View file

@ -621,6 +621,7 @@ class JWTAuthManager:
@staticmethod
async def get_objects(
user_id: Optional[str],
user_email: Optional[str],
org_id: Optional[str],
end_user_id: Optional[str],
valid_user_email: Optional[bool],
@ -661,6 +662,8 @@ class JWTAuthManager:
),
parent_otel_span=parent_otel_span,
proxy_logging_obj=proxy_logging_obj,
user_email=user_email,
sso_user_id=user_id,
)
if user_id
else None
@ -704,7 +707,7 @@ class JWTAuthManager:
# Get basic user info
scopes = jwt_handler.get_scopes(token=jwt_valid_token)
user_id, _, valid_user_email = await JWTAuthManager.get_user_info(
user_id, user_email, valid_user_email = await JWTAuthManager.get_user_info(
jwt_handler, jwt_valid_token
)
@ -748,6 +751,7 @@ class JWTAuthManager:
# Get other objects
user_object, org_object, end_user_object = await JWTAuthManager.get_objects(
user_id=user_id,
user_email=user_email,
org_id=org_id,
end_user_id=end_user_id,
valid_user_email=valid_user_email,