Class AuthorizerScenarios

java.lang.Object
org.pac4j.testkit.AuthorizerScenarios

public final class AuthorizerScenarios extends Object
Pre-assembled HTTP test scenarios for authorization rules: RequireAllRoles authorizer, HTTP method matchers, and path matchers.
  • Method Details

    • runRequireAllRolesAccessGranted

      public static void runRequireAllRolesAccessGranted(String serverUrl) throws IOException
      GET /protected with JWT containing both ROLE_USER and ROLE_ADMIN -> 200
      Throws:
      IOException
    • runRequireAllRolesAccessDenied

      public static void runRequireAllRolesAccessDenied(String serverUrl) throws IOException
      GET /protected with JWT containing only ROLE_USER -> 403
      Throws:
      IOException
    • runMethodMatcherGetAllowed

      public static void runMethodMatcherGetAllowed(String serverUrl) throws IOException
      GET /protected with valid JWT -> 200 (GET allowed)
      Throws:
      IOException
    • runMethodMatcherPostDenied

      public static void runMethodMatcherPostDenied(String serverUrl) throws IOException
      POST /protected with valid JWT -> 403 (POST denied by matcher)
      Throws:
      IOException
    • runPathMatcherProtected

      public static void runPathMatcherProtected(String serverUrl) throws IOException
      GET /protected with valid JWT -> 200 (path requires auth)
      Throws:
      IOException
    • runPathMatcherOtherPublic

      public static void runPathMatcherOtherPublic(String serverUrl) throws IOException
      GET /other with no auth -> 200 (path excluded from security)
      Throws:
      IOException