Package org.pac4j.testkit
Class TestConfigs
java.lang.Object
org.pac4j.testkit.TestConfigs
Provides standard pac4j Config objects for each authentication mechanism.
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.pac4j.core.config.ConfigJWT config where /protected requires BOTH ROLE_USER and ROLE_ADMIN.static org.pac4j.core.config.ConfigHTTP Basic authentication.static org.pac4j.core.config.ConfigJWT (Bearer token) AND API Key (X-Api-Key) chained on the same endpoint.static org.pac4j.core.config.ConfigAPI key via X-Api-Key header.static org.pac4j.core.config.ConfigForm-based authentication with username/password POST.static org.pac4j.core.config.ConfigJWT via Authorization: Bearer token header.static org.pac4j.core.config.ConfigJWT config where /protected allows GET but denies POST via HttpMethodMatcher.static org.pac4j.core.config.ConfigoidcConfig(String mockOAuthServerUrl) OAuth2/OIDC authorization code flow via mock-oauth2-server.static org.pac4j.core.config.ConfigJWT config where /protected requires auth but /other is public via PathMatcher.
-
Method Details
-
jwtConfig
public static org.pac4j.core.config.Config jwtConfig()JWT via Authorization: Bearer token header. -
formConfig
public static org.pac4j.core.config.Config formConfig()Form-based authentication with username/password POST. -
basicAuthConfig
public static org.pac4j.core.config.Config basicAuthConfig()HTTP Basic authentication. -
chainedConfig
public static org.pac4j.core.config.Config chainedConfig()JWT (Bearer token) AND API Key (X-Api-Key) chained on the same endpoint. JWT tried first. -
directConfig
public static org.pac4j.core.config.Config directConfig()API key via X-Api-Key header. -
allRolesAuthorizerConfig
public static org.pac4j.core.config.Config allRolesAuthorizerConfig()JWT config where /protected requires BOTH ROLE_USER and ROLE_ADMIN. -
methodMatcherConfig
public static org.pac4j.core.config.Config methodMatcherConfig()JWT config where /protected allows GET but denies POST via HttpMethodMatcher. -
pathMatcherConfig
public static org.pac4j.core.config.Config pathMatcherConfig()JWT config where /protected requires auth but /other is public via PathMatcher. -
oidcConfig
OAuth2/OIDC authorization code flow via mock-oauth2-server.- Parameters:
mockOAuthServerUrl- base URL of the running mock-oauth2-server (e.g. http://localhost:12345)
-