Revert "(UI) - Security Improvement, move to JWT Auth for Admin UI Sessions (#8995)"

This reverts commit 01a44a4e47.
This commit is contained in:
Ishaan Jaff 2025-03-05 08:49:20 -08:00
parent 3d5b578fac
commit 2cc590938f
17 changed files with 539 additions and 1105 deletions

View file

@ -51,7 +51,6 @@ from litellm.proxy.auth.oauth2_proxy_hook import handle_oauth2_proxy_request
from litellm.proxy.auth.route_checks import RouteChecks
from litellm.proxy.auth.service_account_checks import service_account_checks
from litellm.proxy.common_utils.http_parsing_utils import _read_request_body
from litellm.proxy.management_helpers.ui_session_handler import UISessionHandler
from litellm.proxy.utils import PrismaClient, ProxyLogging, _to_ns
from litellm.types.services import ServiceTypes
@ -336,7 +335,6 @@ async def _user_api_key_auth_builder( # noqa: PLR0915
"pass_through_endpoints", None
)
passed_in_key: Optional[str] = None
cookie_token: Optional[str] = None
if isinstance(api_key, str):
passed_in_key = api_key
api_key = _get_bearer_token(api_key=api_key)
@ -346,10 +344,6 @@ async def _user_api_key_auth_builder( # noqa: PLR0915
api_key = anthropic_api_key_header
elif isinstance(google_ai_studio_api_key_header, str):
api_key = google_ai_studio_api_key_header
elif cookie_token := UISessionHandler._get_ui_session_token_from_cookies(
request
):
api_key = cookie_token
elif pass_through_endpoints is not None:
for endpoint in pass_through_endpoints:
if endpoint.get("path", "") == route:
@ -426,10 +420,7 @@ async def _user_api_key_auth_builder( # noqa: PLR0915
if general_settings.get("enable_oauth2_proxy_auth", False) is True:
return await handle_oauth2_proxy_request(request=request)
if (
general_settings.get("enable_jwt_auth", False) is True
or cookie_token is not None
):
if general_settings.get("enable_jwt_auth", False) is True:
from litellm.proxy.proxy_server import premium_user
if premium_user is not True: