Package org.apache.shiro.authc.pam
Class AtLeastOneSuccessfulStrategy
- java.lang.Object
-
- org.apache.shiro.authc.pam.AbstractAuthenticationStrategy
-
- org.apache.shiro.authc.pam.AtLeastOneSuccessfulStrategy
-
- All Implemented Interfaces:
AuthenticationStrategy
public class AtLeastOneSuccessfulStrategy extends AbstractAuthenticationStrategy
AuthenticationStrategy implementation that requires at least one configured realm to successfully process the submitted AuthenticationToken during the log-in attempt.This means any number of configured realms do not have to support the submitted log-in token, or they may be unable to acquire AuthenticationInfo 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.
Note that this implementation will aggregate the account data from all 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
FirstSuccessfulAuthenticationStrategy
instead.- Since:
- 0.2
- See Also:
FirstSuccessfulAuthenticationStrategy
-
-
Constructor Summary
Constructors Constructor Description AtLeastOneSuccessfulStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthenticationInfo
afterAllAttempts(AuthenticationToken token, AuthenticationInfo aggregate)
Ensures that theaggregate
method argument is notnull
andaggregate.
is notgetPrincipals()
null
, and if either isnull
, throws an AuthenticationException to indicate that none of the realms authenticated successfully.-
Methods inherited from class org.apache.shiro.authc.pam.AbstractAuthenticationStrategy
afterAttempt, beforeAllAttempts, beforeAttempt, merge
-
-
-
-
Method Detail
-
afterAllAttempts
public AuthenticationInfo afterAllAttempts(AuthenticationToken token, AuthenticationInfo aggregate) throws AuthenticationException
Ensures that theaggregate
method argument is notnull
andaggregate.
is notgetPrincipals()
null
, and if either isnull
, throws an AuthenticationException to indicate that none of the realms authenticated successfully.- Specified by:
afterAllAttempts
in interfaceAuthenticationStrategy
- Overrides:
afterAllAttempts
in classAbstractAuthenticationStrategy
- Parameters:
token
- theAuthenticationToken
submitted for the subject attempting system log-in.aggregate
- the aggregateAuthenticationInfo
instance populated by all realms during the log-in attempt.- Returns:
- the final
AuthenticationInfo
object to return to the Authenticator.authenticate() caller. - Throws:
AuthenticationException
- if the Strategy implementation wishes to fail the authentication attempt.
-
-