Class OAuthScenarios

java.lang.Object
org.pac4j.testkit.OAuthScenarios

public final class OAuthScenarios extends Object
Pre-assembled HTTP test scenarios for OAuth2/OIDC authorization code flow. Requires mock-oauth2-server running. The consumer starts it before tests, passes its URL, and stops it after.
  • Method Details

    • runAuthorizationCodeFlow

      public static void runAuthorizationCodeFlow(String serverUrl, no.nav.security.mock.oauth2.MockOAuth2Server mockServer) throws IOException
      Full authorization code flow: GET /protected -> redirect to IdP -> follow redirects through authorize -> callback -> /protected -> 200
      Throws:
      IOException
    • runUnauthenticatedRedirect

      public static void runUnauthenticatedRedirect(String serverUrl, String mockOAuthServerUrl) throws IOException
      Verify unauthenticated access redirects to the IdP's authorize endpoint.
      Throws:
      IOException