litellm/tests/test_litellm/proxy/management_endpoints
yuneng-jiang e445694a40 fix(sso): preserve SSO role regardless of role_mappings configuration
When `default_internal_user_params` was set, `insert_sso_user()` only
preserved SSO-provided roles if `role_mappings` was explicitly configured.
Roles from other valid SSO sources (Microsoft app_roles,
GENERIC_USER_ROLE_ATTRIBUTE, custom SSO handlers) were silently
overwritten with the default "internal_user" role, causing admin users
to be downgraded on first login or after user deletion.

Replace the `role_mappings_configured` gate with `_should_use_role_from_sso_response()`
which validates the role is a recognized LitellmUserRoles value regardless
of origin. Also removes an unnecessary DB round-trip to litellm_ssoconfig
on every new SSO user creation.

Fixes: admin users seeing internal-user UI after SSO login
Fixes: test_get_redirect_url_for_sso flaking due to local env vars

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-18 15:24:18 -08:00
..
scim feat: add base /scim/v2 endpoint for SCIM resource discovery (#20301) 2026-02-02 14:27:00 -08:00
search_endpoints masking sensitive values 2026-02-03 16:09:37 -08:00
test_access_group_endpoints.py cache adjustment for deleted teams and keys 2026-02-14 09:28:02 -08:00
test_access_group_management.py [Feat] Model Management API - Add API Endpoint for creating model access group (#16663) 2025-11-14 16:40:43 -08:00
test_budget_endpoints.py [Release - 02/10/2026] v1.81.10-nightly 2026-02-10 16:26:30 -08:00
test_cache_settings_endpoints.py [Feat] UI - Allow setting cache settings on UI (#16143) 2025-10-31 17:43:59 -07:00
test_callback_management_endpoints.py [Feat] AI Gateway Auth - Allow using JWTs for signing in with Proxy CLI (#16756) 2025-11-17 19:47:29 -08:00
test_common_daily_activity.py fix: preserve key alias and team_id after key regeneration, deletion 2026-02-07 17:08:01 -08:00
test_common_utils.py allow team and org admins to call invitation/new 2026-02-11 11:23:27 -08:00
test_cost_tracking_settings.py [Feat] UI - Allow setting Provider Discounts on UI (#15550) 2025-10-14 20:08:18 -07:00
test_customer_budget.py test(customer): add unit tests for customer budget update functionality 2025-07-30 17:01:18 +00:00
test_customer_endpoints.py Adding tests 2025-12-04 12:36:15 -08:00
test_delete_callbacks_endpoint.py test_delete_callbacks_in_db 2025-11-08 14:05:44 -08:00
test_entraid_app_roles.py fix: app_roles missing from jwt payload (#16448) 2025-11-12 12:07:04 -08:00
test_internal_user_endpoints.py address greptile review feedback (greploop iteration 2) 2026-02-16 17:37:18 -08:00
test_key_management_endpoints.py tests 2026-02-13 22:01:28 -08:00
test_mcp_management_endpoints.py MCP fixes 2026-02-11 18:07:24 -08:00
test_model_management_endpoints.py Fix: Make PATCH /model/{model_id}/update handle team_id consistently with POST /model/new (#15297) 2025-10-07 14:04:08 -07:00
test_organization_endpoints.py optional query params for org list 2026-01-10 14:44:28 -08:00
test_router_settings_endpoints.py New endpoint for router fields + react query 2026-01-09 16:49:22 -08:00
test_tag_management_endpoints.py Fix tag management to preserve encrypted fields in litellm_params (#17484) 2025-12-18 02:28:39 +05:30
test_team_endpoints.py modernize /team/available endpoint, migrate link to UI 2026-02-07 16:44:29 -08:00
test_ui_sso.py fix(sso): preserve SSO role regardless of role_mappings configuration 2026-02-18 15:24:18 -08:00