Class AllSuccessfulStrategy
java.lang.Object
org.apache.shiro.authc.pam.AbstractAuthenticationStrategy
org.apache.shiro.authc.pam.AllSuccessfulStrategy
- All Implemented Interfaces:
AuthenticationStrategy
AuthenticationStrategy implementation that requires all configured realms to
successfully process the submitted AuthenticationToken during the log-in attempt.
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).
- Since:
- 0.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionafterAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo info, AuthenticationInfo aggregate, Throwable t) Merges the specifiedinfointo theaggregateargument and returns it (just as the parent implementation does), but additionally ensures the following: if theThrowableargument is notnull, re-throws it to immediately cancel the authentication process, since this strategy requires all realms to authenticate successfully. neither theinfooraggregateargument isnullto ensure that each realm did in fact authenticate successfullybeforeAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo info) Because all realms in this strategy must complete successfully, this implementation ensures that the givenRealmsupportsthe giventokenargument.Methods inherited from class org.apache.shiro.authc.pam.AbstractAuthenticationStrategy
afterAllAttempts, beforeAllAttempts, merge
-
Constructor Details
-
AllSuccessfulStrategy
public AllSuccessfulStrategy()
-
-
Method Details
-
beforeAttempt
public AuthenticationInfo beforeAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo info) throws AuthenticationException Because all realms in this strategy must complete successfully, this implementation ensures that the givenRealmsupportsthe giventokenargument. If it does not, this method throws anUnsupportedTokenExceptionto end the authentication process immediately. If the realm does support the token, theinfoargument is returned immediately.- Specified by:
beforeAttemptin interfaceAuthenticationStrategy- Overrides:
beforeAttemptin classAbstractAuthenticationStrategy- Parameters:
realm- the realm that will be consulted forAuthenticationInfofor the specifiedtoken.token- theAuthenticationTokensubmitted for the subject attempting system log-in.info- the aggregated AuthenticationInfo object being used across the multi-realm authentication attempt- Returns:
- the AuthenticationInfo object that will be presented to further realms in the authentication process - returning
the
aggregatemethod argument is the normal case if no special action needs to be taken. - Throws:
AuthenticationException- an exception thrown by the Strategy implementation if it wishes the login process for the associated subject (user) to stop immediately.
-
afterAttempt
public AuthenticationInfo afterAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo info, AuthenticationInfo aggregate, Throwable t) throws AuthenticationException Merges the specifiedinfointo theaggregateargument and returns it (just as the parent implementation does), but additionally ensures the following:- if the
Throwableargument is notnull, re-throws it to immediately cancel the authentication process, since this strategy requires all realms to authenticate successfully. - neither the
infooraggregateargument isnullto ensure that each realm did in fact authenticate successfully
- Specified by:
afterAttemptin interfaceAuthenticationStrategy- Overrides:
afterAttemptin classAbstractAuthenticationStrategy- Parameters:
realm- the realm that was just consulted forAuthenticationInfofor the giventoken.token- theAuthenticationTokensubmitted 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, ornullif the method returned normally.- Returns:
- the AuthenticationInfo object that will be presented to further realms in the authentication process - returning
the
aggregateAccountmethod argument is the normal case if no special action needs to be taken. - Throws:
AuthenticationException- an exception thrown by the Strategy implementation if it wishes the login process for the associated subject (user) to stop immediately.
- if the
-