AtLeastOneSuccessfulStrategy

<tt>AuthenticationStrategy</tt> implementation that requires <em>at least one</em> configured realm to successfully process the submitted <tt>AuthenticationToken</tt> during the log-in attempt. <p/> <p>This means any number of configured realms do not have to support the submitted log-in token, or they may be unable to acquire <tt>AuthenticationInfo</tt> 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. <p/> <p>Note that this implementation will aggregate the account data from <em>all</em> 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 {@link FirstSuccessfulStrategy FirstSuccessfulAuthenticationStrategy} instead.

@see FirstSuccessfulStrategy FirstSuccessfulAuthenticationStrategy

Members

Functions

afterAllAttempts
AuthenticationInfo afterAllAttempts(AuthenticationToken token, AuthenticationInfo aggregate)

Ensures that the <code>aggregate</code> method argument is not <code>null</code> and <code>aggregate.{@link hunt.shiro.authc.AuthenticationInfo#getPrincipals() getPrincipals()}</code> is not <code>null</code>, and if either is <code>null</code>, that none of the realms authenticated successfully.

Inherited Members

From AbstractAuthenticationStrategy

beforeAllAttempts
AuthenticationInfo beforeAllAttempts(Realm[] realms, AuthenticationToken token)

Simply returns <code>new {@link hunt.shiro.authc.SimpleAuthenticationInfo SimpleAuthenticationInfo}();</code>, which supports aggregating account data across realms.

beforeAttempt
AuthenticationInfo beforeAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo aggregate)

Simply returns the <code>aggregate</code> method argument, without modification.

afterAttempt
AuthenticationInfo afterAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo singleRealmInfo, AuthenticationInfo aggregateInfo, Throwable t)

Base implementation that will aggregate the specified <code>singleRealmInfo</code> into the <code>aggregateInfo</code> and then returns the aggregate. Can be overridden by subclasses for custom behavior.

merge
AuthenticationInfo merge(AuthenticationInfo info, AuthenticationInfo aggregate)

Merges the specified <code>info</code> argument into the <code>aggregate</code> argument and then returns an aggregate for continued use throughout the login process. <p/> This implementation merely checks to see if the specified <code>aggregate</code> argument is an instance of {@link hunt.shiro.authc.MergableAuthenticationInfo MergableAuthenticationInfo}, and if so, calls <code>aggregate.merge(info)</code> If it is <em>not</em> an instance of <code>MergableAuthenticationInfo</code>, an {@link IllegalArgumentException IllegalArgumentException} is thrown. Can be overridden by subclasses for custom merging behavior if implementing the {@link hunt.shiro.authc.MergableAuthenticationInfo MergableAuthenticationInfo} is not desired for some reason.

afterAllAttempts
AuthenticationInfo afterAllAttempts(AuthenticationToken token, AuthenticationInfo aggregate)

Simply returns the <code>aggregate</code> argument without modification. Can be overridden for custom behavior.

Meta