public class AllSuccessfulStrategy extends AbstractAuthenticationStrategy
If one or more realms do not support the submitted token, or one or more are unable to acquire AuthenticationInfo for the token, this implementation will immediately fail the log-in attempt for the associated subject (user).
Constructor and Description |
---|
AllSuccessfulStrategy() |
Modifier and Type | Method and Description |
---|---|
AuthenticationInfo |
afterAttempt(Realm realm,
AuthenticationToken token,
AuthenticationInfo info,
AuthenticationInfo aggregate,
Throwable t)
Merges the specified
info into the aggregate argument and returns it (just as the
parent implementation does), but additionally ensures the following:
if the Throwable argument is not null , re-throws it to immediately cancel the
authentication process, since this strategy requires all realms to authenticate successfully. |
AuthenticationInfo |
beforeAttempt(Realm realm,
AuthenticationToken token,
AuthenticationInfo info)
Because all realms in this strategy must complete successfully, this implementation ensures that the given
Realm supports the given
token argument. |
afterAllAttempts, beforeAllAttempts, merge
public AllSuccessfulStrategy()
public AuthenticationInfo beforeAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo info) throws AuthenticationException
Realm
supports
the given
token
argument. If it does not, this method throws an
UnsupportedTokenException
to end the authentication
process immediately. If the realm does support the token, the info
argument is returned immediately.beforeAttempt
in interface AuthenticationStrategy
beforeAttempt
in class AbstractAuthenticationStrategy
realm
- the realm that will be consulted for AuthenticationInfo
for the specified token
.token
- the AuthenticationToken
submitted for the subject attempting system log-in.info
- the aggregated AuthenticationInfo object being used across the multi-realm authentication attemptaggregate
method argument is the normal case if no special action needs to be taken.AuthenticationException
- an exception thrown by the Strategy implementation if it wishes the login
process for the associated subject (user) to stop immediately.public AuthenticationInfo afterAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo info, AuthenticationInfo aggregate, Throwable t) throws AuthenticationException
info
into the aggregate
argument and returns it (just as the
parent implementation does), but additionally ensures the following:
Throwable
argument is not null
, re-throws it to immediately cancel the
authentication process, since this strategy requires all realms to authenticate successfully.info
or aggregate
argument is null
to ensure that each
realm did in fact authenticate successfullyafterAttempt
in interface AuthenticationStrategy
afterAttempt
in class AbstractAuthenticationStrategy
realm
- the realm that was just consulted for AuthenticationInfo
for the given token
.token
- the AuthenticationToken
submitted for the subject attempting system log-in.info
- the info returned from a single realm.aggregate
- the aggregate info representing all realms in a multi-realm environment.t
- the Throwable thrown by the Realm during the attempt, or null
if the method returned normally.aggregateAccount
method argument is the normal case if no special action needs to be taken.AuthenticationException
- an exception thrown by the Strategy implementation if it wishes the login process
for the associated subject (user) to stop immediately.Copyright © 2004–2017 The Apache Software Foundation. All rights reserved.