- All Implemented Interfaces:
Extension
Usage:
- Add pac4j dependency
- Add pac4j client dependency, like oauth, openid, etc... (Optional)
- Install them
{
install(new Pac4jModule());
}
- Use it
{
get("/", ctx -> {
UserProfile user = ctx.getUser();
});
}
Previous example install a simple login form and give you access to profile details via Context.getUser().- Since:
- 2.4.0.
- Author:
- edgar
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new pac4j module.Pac4jModule(Pac4jOptions options) Creates a new pac4j module.Pac4jModule(org.pac4j.core.config.Config options) Creates a new pac4j module. -
Method Summary
Modifier and TypeMethodDescriptionclient(Class<? extends org.pac4j.core.authorization.authorizer.Authorizer> authorizer, Class<? extends org.pac4j.core.client.Client> client) Register a default security filter.client(Class<? extends org.pac4j.core.authorization.authorizer.Authorizer> authorizer, Function<com.typesafe.config.Config, org.pac4j.core.client.Client> provider) Register a default security filter.Register a default security filter.client(String pattern, Class<? extends org.pac4j.core.authorization.authorizer.Authorizer> authorizer, Class<? extends org.pac4j.core.client.Client> client) Register a security filter under the given path.client(String pattern, Class<? extends org.pac4j.core.authorization.authorizer.Authorizer> authorizer, Function<com.typesafe.config.Config, org.pac4j.core.client.Client> provider) Register a security filter under the given path.Register a security filter under the given path.Register a filter under the given path.client(String pattern, String authorizer, Function<com.typesafe.config.Config, org.pac4j.core.client.Client> provider) Register a filter under the given path.Register a security filter under the given path.client(String pattern, org.pac4j.core.authorization.authorizer.Authorizer authorizer, Class<? extends org.pac4j.core.client.Client> client) Register a security filter under the given path.client(String pattern, org.pac4j.core.authorization.authorizer.Authorizer authorizer, Function<com.typesafe.config.Config, org.pac4j.core.client.Client> provider) Register a security filter under the given path.Register a default security filter.client(org.pac4j.core.authorization.authorizer.Authorizer authorizer, Class<? extends org.pac4j.core.client.Client> client) Register a default security filter.client(org.pac4j.core.authorization.authorizer.Authorizer authorizer, Function<com.typesafe.config.Config, org.pac4j.core.client.Client> provider) Register a default security filter.voidstatic org.pac4j.core.http.adapter.HttpActionAdapterDefault action adapter.static org.pac4j.core.engine.DefaultCallbackLogicnewCallbackLogic(Set<String> excludes) Default callback logic and optionally specify the pattern to excludes while saving user requested urls.static org.pac4j.core.engine.LogoutLogicCreates a default logout logic.static org.pac4j.core.engine.DefaultSecurityLogicnewSecurityLogic(Set<String> excludes) Default security logic and optionally specify the pattern to excludes while saving user requested urls.static org.pac4j.core.http.url.UrlResolverDefault url resolver.
-
Constructor Details
-
Pac4jModule
public Pac4jModule()Creates a new pac4j module. -
Pac4jModule
Creates a new pac4j module.- Parameters:
options- Options.
-
Pac4jModule
public Pac4jModule(org.pac4j.core.config.Config options) Creates a new pac4j module.- Parameters:
options- Options.
-
-
Method Details
-
client
public Pac4jModule client(Function<com.typesafe.config.Config, org.pac4j.core.client.Client> provider) Register a default security filter.- Parameters:
provider- Client factory.- Returns:
- This module.
-
client
public Pac4jModule client(String pattern, Function<com.typesafe.config.Config, org.pac4j.core.client.Client> provider) Register a security filter under the given path.- Parameters:
pattern- Protected pattern.provider- Client factory.- Returns:
- This module.
-
client
public Pac4jModule client(Class<? extends org.pac4j.core.authorization.authorizer.Authorizer> authorizer, Function<com.typesafe.config.Config, org.pac4j.core.client.Client> provider) Register a default security filter.NOTE: the authorizer is attached to the given path pattern (not the client). All the authorizers added to the path applies to all the registered clients.
- Parameters:
authorizer- Authorizer to use. Authorizer must be provisioned by application registry.provider- Client factory.- Returns:
- This module.
-
client
@NonNull public Pac4jModule client(@NonNull org.pac4j.core.authorization.authorizer.Authorizer authorizer, @NonNull Function<com.typesafe.config.Config, org.pac4j.core.client.Client> provider) Register a default security filter.NOTE: the authorizer is attached to the given path pattern (not the client). All the authorizers added to the path applies to all the registered clients.
- Parameters:
authorizer- Authorizer to use.provider- Client factory.- Returns:
- This module.
-
client
@NonNull public Pac4jModule client(@NonNull String pattern, @NonNull Class<? extends org.pac4j.core.authorization.authorizer.Authorizer> authorizer, @NonNull Function<com.typesafe.config.Config, org.pac4j.core.client.Client> provider) Register a security filter under the given path.NOTE: the authorizer is attached to the given path pattern (not the client). All the authorizers added to the path applies to all the registered clients.
- Parameters:
pattern- Protected pattern. Use*for intercept all calls.authorizer- Authorizer to use. Authorizer must be provisioned by application registry.provider- Client factory.- Returns:
- This module.
-
client
@NonNull public Pac4jModule client(@NonNull String pattern, @NonNull org.pac4j.core.authorization.authorizer.Authorizer authorizer, @NonNull Function<com.typesafe.config.Config, org.pac4j.core.client.Client> provider) Register a security filter under the given path.NOTE: the authorizer is attached to the given path pattern (not the client). All the authorizers added to the path applies to all the registered clients.
- Parameters:
pattern- Protected pattern. Use*for intercept all calls.authorizer- Authorizer to use.provider- Client factory.- Returns:
- This module.
-
client
@NonNull public Pac4jModule client(@NonNull String pattern, @Nullable String authorizer, @NonNull Function<com.typesafe.config.Config, org.pac4j.core.client.Client> provider) Register a filter under the given path.NOTE: the authorizer is attached to the given path pattern (not the client). All the authorizers added to the path applies to all the registered clients.
- Parameters:
pattern- Protected pattern. Use*for intercept all calls.authorizer- Authorizer to use. Must be registered viaConfig.addAuthorizer(String, Authorizer). Null is allowed.provider- Client factory.- Returns:
- This module.
-
client
Register a default security filter.- Parameters:
client- Client class.- Returns:
- This module.
-
client
public Pac4jModule client(@NonNull String pattern, @NonNull Class<? extends org.pac4j.core.client.Client> client) Register a security filter under the given path.- Parameters:
pattern- Protected pattern.client- Client class.- Returns:
- This module.
-
client
public Pac4jModule client(@NonNull Class<? extends org.pac4j.core.authorization.authorizer.Authorizer> authorizer, @NonNull Class<? extends org.pac4j.core.client.Client> client) Register a default security filter.NOTE: the authorizer is attached to the given path pattern (not the client). All the authorizers added to the path applies to all the registered clients.
- Parameters:
authorizer- Authorizer to use. Authorizer must be provisioned by application registry.client- Client class.- Returns:
- This module.
-
client
@NonNull public Pac4jModule client(@NonNull org.pac4j.core.authorization.authorizer.Authorizer authorizer, @NonNull Class<? extends org.pac4j.core.client.Client> client) Register a default security filter.NOTE: the authorizer is attached to the given path pattern (not the client). All the authorizers added to the path applies to all the registered clients.
- Parameters:
authorizer- Authorizer to use.client- Client class.- Returns:
- This module.
-
client
@NonNull public Pac4jModule client(@NonNull String pattern, @NonNull Class<? extends org.pac4j.core.authorization.authorizer.Authorizer> authorizer, @NonNull Class<? extends org.pac4j.core.client.Client> client) Register a security filter under the given path.NOTE: the authorizer is attached to the given path pattern (not the client). All the authorizers added to the path applies to all the registered clients.
- Parameters:
pattern- Protected pattern. Use*for intercept all calls.authorizer- Authorizer to use. Authorizer must be provisioned by application registry.client- Client class.- Returns:
- This module.
-
client
@NonNull public Pac4jModule client(@NonNull String pattern, @NonNull org.pac4j.core.authorization.authorizer.Authorizer authorizer, @NonNull Class<? extends org.pac4j.core.client.Client> client) Register a security filter under the given path.NOTE: the authorizer is attached to the given path pattern (not the client). All the authorizers added to the path applies to all the registered clients.
- Parameters:
pattern- Protected pattern. Use*for intercept all calls.authorizer- Authorizer to use.client- Client class.- Returns:
- This module.
-
client
@NonNull public Pac4jModule client(@NonNull String pattern, @Nullable String authorizer, @NonNull Class<? extends org.pac4j.core.client.Client> client) Register a filter under the given path.NOTE: the authorizer is attached to the given path pattern (not the client). All the authorizers added to the path applies to all the registered clients.
- Parameters:
pattern- Protected pattern. Use*for intercept all calls.authorizer- Authorizer to use. Must be registered viaConfig.addAuthorizer(String, Authorizer). Null is allowed.client- Client class.- Returns:
- This module.
-
install
-
newLogoutLogic
public static org.pac4j.core.engine.LogoutLogic newLogoutLogic()Creates a default logout logic.- Returns:
- Default logout logic.
-
newActionAdapter
public static org.pac4j.core.http.adapter.HttpActionAdapter newActionAdapter()Default action adapter.- Returns:
- Default action adapter.
-
newSecurityLogic
Default security logic and optionally specify the pattern to excludes while saving user requested urls.- Parameters:
excludes- Pattern to ignores.- Returns:
- Default security logic.
-
newCallbackLogic
Default callback logic and optionally specify the pattern to excludes while saving user requested urls.- Parameters:
excludes- Pattern to ignores.- Returns:
- Default callback logic.
-
newUrlResolver
public static org.pac4j.core.http.url.UrlResolver newUrlResolver()Default url resolver.- Returns:
- Default url resolver.
-