The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(ui_sso.py): support both 'app_roles' and 'roles' claim on jwt decode for SSO handler
Krrish Dholakiab85aeb08ce18
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.jsonindex 8e5b8251f6f..8cab321c4dd 100644--- a/litellm/model_prices_and_context_window_backup.json+++ b/litellm/model_prices_and_context_window_backup.json@@ -21915,8 +21915,8 @@"input_cost_per_token_batches": 7.5e-06,"litellm_provider": "vertex_ai-anthropic_models","max_input_tokens": 200000,- "max_output_tokens": 4096,- "max_tokens": 4096,+ "max_output_tokens": 32000,+ "max_tokens": 32000,"mode": "chat","output_cost_per_token": 7.5e-05,"output_cost_per_token_batches": 3.75e-05,@@ -21932,8 +21932,8 @@"input_cost_per_token_batches": 7.5e-06,"litellm_provider": "vertex_ai-anthropic_models","max_input_tokens": 200000,- "max_output_tokens": 4096,- "max_tokens": 4096,+ "max_output_tokens": 32000,+ "max_tokens": 32000,"mode": "chat","output_cost_per_token": 7.5e-05,"output_cost_per_token_batches": 3.75e-05,diff --git a/litellm/proxy/management_endpoints/ui_sso.py b/litellm/proxy/management_endpoints/ui_sso.pyindex 54909b9712b..541f7656d20 100644--- a/litellm/proxy/management_endpoints/ui_sso.py+++ b/litellm/proxy/management_endpoints/ui_sso.py@@ -875,9 +875,9 @@ async def insert_sso_user(if user_defined_values.get("max_budget") is None:user_defined_values["max_budget"] = litellm.max_internal_user_budgetif user_defined_values.get("budget_duration") is None:- user_defined_values[- "budget_duration"- ] = litellm.internal_user_budget_duration+ user_defined_values["budget_duration"] = (+ litellm.internal_user_budget_duration+ )if user_defined_values["user_role"] is None:user_defined_values["user_role"] = LitellmUserRoles.INTERNAL_USER_VIEW_ONLY@@ -1118,9 +1118,9 @@ class SSOAuthenticationHandler:generic_authorization_endpointand "okta" in generic_authorization_endpoint):- redirect_params[- "state"- ] = uuid.uuid4().hex # set state param for okta - required+ redirect_params["state"] = (+ uuid.uuid4().hex+ ) # set state param for okta - requiredreturn redirect_params@@ -1699,9 +1699,9 @@ class MicrosoftSSOHandler:# if user is trying to get the raw sso response for debugging, return the raw sso responseif return_raw_sso_response:- original_msft_result[- MicrosoftSSOHandler.GRAPH_API_RESPONSE_KEY- ] = user_team_ids+ original_msft_result[MicrosoftSSOHandler.GRAPH_API_RESPONSE_KEY] = (+ user_team_ids+ )original_msft_result["app_roles"] = app_rolesreturn original_msft_result or {}@@ -1759,7 +1759,8 @@ class MicrosoftSSOHandler:decoded_token = jwt.decode(id_token, options={"verify_signature": False})# Extract app_roles claim from the token- roles = decoded_token.get("app_roles", [])+ ## check for both 'roles' and 'app_roles' claims+ roles = decoded_token.get("app_roles", []) or decoded_token.get("roles", [])if roles and isinstance(roles, list):verbose_proxy_logger.debug(@@ -1817,9 +1818,9 @@ class MicrosoftSSOHandler:# Fetch user membership from Microsoft Graph APIall_group_ids = []- next_link: Optional[- str- ] = MicrosoftSSOHandler.graph_api_user_groups_endpoint+ next_link: Optional[str] = (+ MicrosoftSSOHandler.graph_api_user_groups_endpoint+ )auth_headers = {"Authorization": f"Bearer {access_token}"}page_count = 0