public class FirstSuccessfulStrategy extends AbstractAuthenticationStrategy
AuthenticationStrategyimplementation that only accepts the account data from the first successfully consulted Realm and ignores all subsequent realms. This is slightly different behavior than
AtLeastOneSuccessfulStrategy, so please review both to see which one meets your needs better.
|Constructor and Description|
|Modifier and Type||Method and Description|
Returns the specified
afterAllAttempts, afterAttempt, beforeAttempt
public AuthenticationInfo beforeAllAttempts(Collection<? extends Realm> realms, AuthenticationToken token) throws AuthenticationException
nullimmediately, relying on this class's
mergeimplementation to return only the first
infoobject it encounters, ignoring all subsequent ones.
realms- the Realms that will be consulted during the authentication process for the specified token.
token- the Principal/Credential representation to be used during authentication for a corresponding subject.
AuthenticationException- if the strategy implementation does not wish the Authentication attempt to execute.
protected AuthenticationInfo merge(AuthenticationInfo info, AuthenticationInfo aggregate)
aggregateinstance if is non null and valid (that is, has principals and they are not empty) immediately, or, if it is null or not valid, the
infoargument is returned instead. This logic ensures that the first valid info encountered is the one retained and all subsequent ones are ignored, since this strategy mandates that only the info from the first successfully authenticated realm be used.
Copyright © 2004–2019 The Apache Software Foundation. All rights reserved.