Package org.apache.shiro.authc.pam
Class AllSuccessfulStrategy
- java.lang.Object
-
- org.apache.shiro.authc.pam.AbstractAuthenticationStrategy
-
- org.apache.shiro.authc.pam.AllSuccessfulStrategy
-
- All Implemented Interfaces:
AuthenticationStrategy
public class AllSuccessfulStrategy extends AbstractAuthenticationStrategy
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 Constructor Description AllSuccessfulStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthenticationInfo
afterAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo info, AuthenticationInfo aggregate, Throwable t)
Merges the specifiedinfo
into theaggregate
argument and returns it (just as the parent implementation does), but additionally ensures the following: if theThrowable
argument is notnull
, re-throws it to immediately cancel the authentication process, since this strategy requires all realms to authenticate successfully. neither theinfo
oraggregate
argument isnull
to ensure that each realm did in fact authenticate successfullyAuthenticationInfo
beforeAttempt(Realm realm, AuthenticationToken token, AuthenticationInfo info)
Because all realms in this strategy must complete successfully, this implementation ensures that the givenRealm
supports
the giventoken
argument.-
Methods inherited from class org.apache.shiro.authc.pam.AbstractAuthenticationStrategy
afterAllAttempts, beforeAllAttempts, merge
-
-
-
-
Method Detail
-
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 givenRealm
supports
the giventoken
argument. If it does not, this method throws anUnsupportedTokenException
to end the authentication process immediately. If the realm does support the token, theinfo
argument is returned immediately.- Specified by:
beforeAttempt
in interfaceAuthenticationStrategy
- Overrides:
beforeAttempt
in classAbstractAuthenticationStrategy
- Parameters:
realm
- the realm that will be consulted forAuthenticationInfo
for the specifiedtoken
.token
- theAuthenticationToken
submitted 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
aggregate
method 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 specifiedinfo
into theaggregate
argument and returns it (just as the parent implementation does), but additionally ensures the following:- if the
Throwable
argument is notnull
, re-throws it to immediately cancel the authentication process, since this strategy requires all realms to authenticate successfully. - neither the
info
oraggregate
argument isnull
to ensure that each realm did in fact authenticate successfully
- Specified by:
afterAttempt
in interfaceAuthenticationStrategy
- Overrides:
afterAttempt
in classAbstractAuthenticationStrategy
- Parameters:
realm
- the realm that was just consulted forAuthenticationInfo
for the giventoken
.token
- theAuthenticationToken
submitted 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, ornull
if the method returned normally.- Returns:
- the AuthenticationInfo object that will be presented to further realms in the authentication process - returning
the
aggregateAccount
method 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
-
-