litellm/tests/test_litellm/auth_v2
Yassin Kortam 55a332bb91 test(auth_v2): cover Casbin-backed RBAC hierarchy and permissions
RBAC moved to an embedded Casbin enforcer: require_roles now honors the role
hierarchy and require_permission gates object/action against the policy.

- rbac: RbacEngine.has_role inherits down the g-rules (platform_admin satisfies
  an org_admin/team_member gate, org_admin satisfies org_viewer, team_admin
  satisfies team_member) and never climbs (team_member fails an org_admin gate);
  enforce honors the default policy (platform_admin any obj/act incl keyMatch2
  on /scim/v2/*, platform_viewer read-only, org_viewer no write) and an operator
  CSV fully replaces the in-code defaults
- security: require_roles passes a higher role through a lower-role gate via the
  hierarchy; require_permission allows platform_admin, denies a viewer on write
  with detail "Forbidden", and 401s when unauthenticated; an RbacEngine injected
  onto the AuthContext overrides the default policy (operator CSV path)

Replaces the removed has_any_role coverage. Mutation-checked: dropping the
hierarchy lookup or short-circuiting enforce fails these.
2026-06-10 18:26:19 -07:00
..
auth_v2_helpers.py test(auth_v2): add test suite for the standards-based auth module 2026-06-10 17:59:29 -07:00
conftest.py test(auth_v2): add test suite for the standards-based auth module 2026-06-10 17:59:29 -07:00
test_authenticators.py test(auth_v2): cover OAuth2 token introspection over the cached async client 2026-06-10 18:25:48 -07:00
test_config.py test(auth_v2): add test suite for the standards-based auth module 2026-06-10 17:59:29 -07:00
test_models.py test(auth_v2): add test suite for the standards-based auth module 2026-06-10 17:59:29 -07:00
test_network.py test(auth_v2): add test suite for the standards-based auth module 2026-06-10 17:59:29 -07:00
test_oidc.py test(auth_v2): add test suite for the standards-based auth module 2026-06-10 17:59:29 -07:00
test_rbac.py test(auth_v2): cover Casbin-backed RBAC hierarchy and permissions 2026-06-10 18:26:19 -07:00
test_resolver.py test(auth_v2): add test suite for the standards-based auth module 2026-06-10 17:59:29 -07:00
test_saml.py test(auth_v2): cover SCIM scim:write guard and SAML RelayState redirect 2026-06-10 18:06:06 -07:00
test_scim.py test(auth_v2): cover SCIM scim:write guard and SAML RelayState redirect 2026-06-10 18:06:06 -07:00
test_security.py test(auth_v2): cover Casbin-backed RBAC hierarchy and permissions 2026-06-10 18:26:19 -07:00