AllSuccessfulStrategy

<tt>AuthenticationStrategy</tt> implementation that requires <em>all</em> configured realms to <b>successfully</b> process the submitted <tt>AuthenticationToken</tt> during the log-in attempt. <p/> <p>If one or more realms do not support the submitted token, or one or more are unable to acquire <tt>AuthenticationInfo</tt> for the token, this implementation will immediately fail the log-in attempt for the associated subject (user).

Members

Functions

afterAttempt
AuthenticationInfo afterAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo info, AuthenticationInfo aggregate, Throwable t)

Merges the specified <code>info</code> into the <code>aggregate</code> argument and returns it (just as the parent implementation does), but additionally ensures the following: <ol> <li>if the <code>Throwable</code> argument is not <code>null</code>, re-throws it to immediately cancel the authentication process, since this strategy requires all realms to authenticate successfully.</li> <li>neither the <code>info</code> or <code>aggregate</code> argument is <code>null</code> to ensure that each realm did in fact authenticate successfully</li> </ol>

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

Because all realms in this strategy must complete successfully, this implementation ensures that the given <code>Realm</code> {@link hunt.shiro.realm.Realm#supports(hunt.shiro.authc.AuthenticationToken) supports} the given <code>token</code> argument. If it does not, this method {@link UnsupportedTokenException UnsupportedTokenException} to end the authentication process immediately. If the realm does support the token, the <code>info</code> argument is returned immediately.

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