public class AtLeastOneSuccessfulStrategy extends AbstractAuthenticationStrategy
This means any number of configured realms do not have to support the submitted log-in token, or they may be unable to acquire AuthenticationInfo for the token, but as long as at least one can do both, this Strategy implementation will allow the log-in process to be successful.
Note that this implementation will aggregate the account data from all successfully consulted
realms during the authentication attempt. If you want only the account data from the first successfully
consulted realm and want to ignore all subsequent realms, use the
FirstSuccessfulAuthenticationStrategy
instead.
FirstSuccessfulAuthenticationStrategy
Constructor and Description |
---|
AtLeastOneSuccessfulStrategy() |
Modifier and Type | Method and Description |
---|---|
AuthenticationInfo |
afterAllAttempts(AuthenticationToken token,
AuthenticationInfo aggregate)
Ensures that the
aggregate method argument is not null and
aggregate.
is not null , and if either is null , throws an AuthenticationException to indicate
that none of the realms authenticated successfully. |
afterAttempt, beforeAllAttempts, beforeAttempt, merge
public AtLeastOneSuccessfulStrategy()
public AuthenticationInfo afterAllAttempts(AuthenticationToken token, AuthenticationInfo aggregate) throws AuthenticationException
aggregate
method argument is not null
and
aggregate.getPrincipals()
is not null
, and if either is null
, throws an AuthenticationException to indicate
that none of the realms authenticated successfully.afterAllAttempts
in interface AuthenticationStrategy
afterAllAttempts
in class AbstractAuthenticationStrategy
token
- the AuthenticationToken
submitted for the subject attempting system log-in.aggregate
- the aggregate AuthenticationInfo
instance populated by all realms during the log-in attempt.AuthenticationInfo
object to return to the Authenticator.authenticate() caller.AuthenticationException
- if the Strategy implementation wishes to fail the authentication attempt.Copyright © 2004–2016 The Apache Software Foundation. All rights reserved.