mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-23 00:41:40 +00:00
* fix return_ui_sso_redirect_response_after_sign_in * add CustomSSOLoginHandler * add handle_custom_ui_sso_sign_in * fix handle_custom_ui_sso_sign_in * fixes for /sso/key/generate * add test_handle_custom_ui_sso_sign_in_success * fixed for loading config * add example custom handler * test_custom_ui_sso_sign_in_handler_config_loading * docs - custom sso * move to enterprise folder * EnterpriseCustomSSOHandler * handle_custom_ui_sso_sign_in * docs custom sso * docs sso * docs custom sso * get_redirect_response_from_openid * fix mock tests
29 lines
No EOL
921 B
Python
29 lines
No EOL
921 B
Python
from fastapi import Request
|
|
from fastapi_sso.sso.base import OpenID
|
|
|
|
from litellm.integrations.custom_logger import CustomLogger
|
|
|
|
|
|
class CustomSSOLoginHandler(CustomLogger):
|
|
"""
|
|
Custom logger for the UI SSO sign in
|
|
|
|
Use this to parse the request headers and return a OpenID object
|
|
|
|
Useful when you have an OAuth proxy in front of LiteLLM
|
|
and you want to use the headers from the proxy to sign in the user
|
|
"""
|
|
async def handle_custom_ui_sso_sign_in(
|
|
self,
|
|
request: Request,
|
|
) -> OpenID:
|
|
request_headers_dict = dict(request.headers)
|
|
return OpenID(
|
|
id=request_headers_dict.get("x-litellm-user-id"),
|
|
email=request_headers_dict.get("x-litellm-user-email"),
|
|
first_name="Test",
|
|
last_name="Test",
|
|
display_name="Test",
|
|
picture="https://test.com/test.png",
|
|
provider="test",
|
|
) |