add debugging for oauth2.0

This commit is contained in:
Ishaan Jaff 2024-08-16 13:40:32 -07:00
parent d4b33cf87c
commit cd28b6607e
2 changed files with 21 additions and 7 deletions

View file

@ -62,6 +62,7 @@ from litellm.proxy.auth.auth_utils import (
is_llm_api_route,
route_in_additonal_public_routes,
)
from litellm.proxy.auth.oauth2_check import check_oauth2_token
from litellm.proxy.common_utils.http_parsing_utils import _read_request_body
from litellm.proxy.utils import _to_ns
@ -197,6 +198,11 @@ async def user_api_key_auth(
# check if public endpoint
return UserAPIKeyAuth(user_role=LitellmUserRoles.INTERNAL_USER_VIEW_ONLY)
if general_settings.get("enable_oauth2_auth", False) is True:
# return UserAPIKeyAuth object
# helper to check if the api_key is a valid oauth2 token
return await check_oauth2_token(token=api_key)
if general_settings.get("enable_jwt_auth", False) is True:
is_jwt = jwt_handler.is_jwt(token=api_key)
verbose_proxy_logger.debug("is_jwt: %s", is_jwt)