Class FormScenarios

java.lang.Object
org.pac4j.testkit.FormScenarios

public final class FormScenarios extends Object
Pre-assembled HTTP test scenarios for form-based authentication.
  • Method Details

    • runHappyPath

      public static void runHappyPath(String serverUrl) throws IOException
      POST /login with valid credentials, follow redirect to /protected -> 200
      Throws:
      IOException
    • runBadCredentials

      public static void runBadCredentials(String serverUrl) throws IOException
      POST /login with wrong password -> redirect to /login?error
      Throws:
      IOException
    • runRedirectAfterLoginToRequestedUrl

      public static void runRedirectAfterLoginToRequestedUrl(String serverUrl) throws IOException
      GET /protected/admin without session -> redirect to /login. POST /login -> redirect back to originally requested /protected/admin (not just /protected).
      Throws:
      IOException
    • runRedirectWhenUnauthenticated

      public static void runRedirectWhenUnauthenticated(String serverUrl) throws IOException
      GET /protected with no session -> redirect to /login
      Throws:
      IOException
    • runLogout

      public static void runLogout(String serverUrl) throws IOException
      POST /logout invalidates session -> /protected redirects to /login
      Throws:
      IOException
    • runLogoutWithCustomRedirect

      public static void runLogoutWithCustomRedirect(String serverUrl) throws IOException
      POST /logout -> redirects to configured post-logout URL. After logout, /protected is inaccessible.
      Throws:
      IOException