Module one.jpro.platform.auth.core
Class CombineAuthenticationProvider
java.lang.Object
one.jpro.platform.auth.core.authentication.CombineAuthenticationProvider
- All Implemented Interfaces:
AuthenticationProvider<Credentials>
public class CombineAuthenticationProvider
extends Object
implements AuthenticationProvider<Credentials>
This class allows for the aggregation of multiple authentication providers,
where the authentication process can be tailored to succeed based on the
success of either all (AND logic) or any (OR logic) of the included providers.
-
Method Summary
Modifier and TypeMethodDescriptionadd(AuthenticationProvider<? super Credentials> other) Adds an authentication provider to this combined authentication provider.all()Creates a combined authentication provider that will resolve if all contained authentication providers are successful.any()Creates a combined authentication provider that will resolve if any contained authentication provider is successful.authenticate(@NotNull Credentials credentials) Authenticate a user with the given credentials.
-
Method Details
-
all
Creates a combined authentication provider that will resolve if all contained authentication providers are successful. This is equivalent to an AND operation among all providers.- Returns:
- new instance of CombineAuthenticationProvider set to require all providers to succeed.
-
any
Creates a combined authentication provider that will resolve if any contained authentication provider is successful. This is equivalent to an OR operation among all providers.- Returns:
- new instance of CombineAuthenticationProvider set to require any provider to succeed.
-
add
Adds an authentication provider to this combined authentication provider.This method allows for the dynamic addition of authentication providers into the combined provider. The added provider will participate in the authentication process according to the logic (all/any) set for this combined provider.
- Parameters:
other- the authentication provider to add- Returns:
- self-reference for method chaining
-
authenticate
Description copied from interface:AuthenticationProviderAuthenticate a user with the given credentials.- Specified by:
authenticatein interfaceAuthenticationProvider<Credentials>- Parameters:
credentials- aCredentialsobject containing the information for authenticating the user.- Returns:
- the result future
-