C
- the type of the credentials instance to be authenticated.R
- the type of the result/response instance to be returned upon an authentication attempt.public final class SequenceAuthenticator<C,R> extends Object implements Authenticator<C,R>
Authenticator
that wraps a sequence of passed authenticators in a new instance.
For the exact behaviour, see authenticate(Object)
.Modifier and Type | Method and Description |
---|---|
R |
authenticate(C credentials)
Calling this method internally delegates to the same method of the passed authenticators in the exact same
order as they have been passed at construction time.
|
Authenticator<? super C,R>[] |
getAuthenticators()
Returns a defensive copy of the internally used authenticator sequence.
|
static <C,R> SequenceAuthenticator<C,R> |
New(Authenticator<? super C,R>... authenticators)
Constructor method that does validation and implementation detail encapsulation of the actual constructor.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
lambda, sequence, then
@SafeVarargs public static final <C,R> SequenceAuthenticator<C,R> New(Authenticator<? super C,R>... authenticators) throws IllegalArgumentException
The passed array of Authenticator
instances may neither be null nor empty.
The created instance uses a copy of the passed array internally to avoid any later side effects.
authenticators
- the authenticators to be evaluated in order.Authenticator
instances.IllegalArgumentException
- if the passed array is empty.authenticate(Object)
public final Authenticator<? super C,R>[] getAuthenticators()
public final R authenticate(C credentials) throws AuthenticationFailedException
Boolean.FALSE
.AuthenticationFailedException
occured.
This effectively creates a multi-attempt Authenticator
that succeed on the first success of one of its
subsidiary authenticators.
authenticate
in interface Authenticator<C,R>
credentials
- the credentials to be evaluated for the authentication.AuthenticationFailedException
- if the last authenticator throws an AuthenticationFailedException
.