Package org.pac4j.testkit
Class AuthorizerScenarios
java.lang.Object
org.pac4j.testkit.AuthorizerScenarios
Pre-assembled HTTP test scenarios for authorization rules:
RequireAllRoles authorizer, HTTP method matchers, and path matchers.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidrunMethodMatcherGetAllowed(String serverUrl) GET /protected with valid JWT -> 200 (GET allowed)static voidrunMethodMatcherPostDenied(String serverUrl) POST /protected with valid JWT -> 403 (POST denied by matcher)static voidrunPathMatcherOtherPublic(String serverUrl) GET /other with no auth -> 200 (path excluded from security)static voidrunPathMatcherProtected(String serverUrl) GET /protected with valid JWT -> 200 (path requires auth)static voidrunRequireAllRolesAccessDenied(String serverUrl) GET /protected with JWT containing only ROLE_USER -> 403static voidrunRequireAllRolesAccessGranted(String serverUrl) GET /protected with JWT containing both ROLE_USER and ROLE_ADMIN -> 200
-
Method Details
-
runRequireAllRolesAccessGranted
GET /protected with JWT containing both ROLE_USER and ROLE_ADMIN -> 200- Throws:
IOException
-
runRequireAllRolesAccessDenied
GET /protected with JWT containing only ROLE_USER -> 403- Throws:
IOException
-
runMethodMatcherGetAllowed
GET /protected with valid JWT -> 200 (GET allowed)- Throws:
IOException
-
runMethodMatcherPostDenied
POST /protected with valid JWT -> 403 (POST denied by matcher)- Throws:
IOException
-
runPathMatcherProtected
GET /protected with valid JWT -> 200 (path requires auth)- Throws:
IOException
-
runPathMatcherOtherPublic
GET /other with no auth -> 200 (path excluded from security)- Throws:
IOException
-