public class ThrowingFirstSuccessfulStrategy
extends org.apache.shiro.authc.pam.FirstSuccessfulStrategy
FirstSuccessfulStrategy with the difference that it
will memoize a AuthenticationServiceUnavailableException thrown by any attempt. It will rethrow this
exception on the final afterAllAttempts(AuthenticationToken, AuthenticationInfo) call, if none of the
attempts were successful.
This way we can retain the fact that authentication probably failed due to a service being unavailable and not because the user's credentials were wrong.
| Constructor and Description |
|---|
ThrowingFirstSuccessfulStrategy() |
| Modifier and Type | Method and Description |
|---|---|
org.apache.shiro.authc.AuthenticationInfo |
afterAllAttempts(org.apache.shiro.authc.AuthenticationToken token,
org.apache.shiro.authc.AuthenticationInfo aggregate)
If none of the attempts was successful and at least one of the attempts was throwing a
AuthenticationServiceUnavailableException, we'll re-throw this exception here. |
org.apache.shiro.authc.AuthenticationInfo |
afterAttempt(org.apache.shiro.realm.Realm realm,
org.apache.shiro.authc.AuthenticationToken token,
org.apache.shiro.authc.AuthenticationInfo singleRealmInfo,
org.apache.shiro.authc.AuthenticationInfo aggregateInfo,
Throwable t)
If the attempt failed due to an
AuthenticationServiceUnavailableException, memoize that exception. |
org.apache.shiro.authc.AuthenticationInfo |
beforeAllAttempts(Collection<? extends org.apache.shiro.realm.Realm> realms,
org.apache.shiro.authc.AuthenticationToken token)
Clear a possible
AuthenticationServiceUnavailableException because this strategy will be re-used for
multiple authentication processes. |
public org.apache.shiro.authc.AuthenticationInfo beforeAllAttempts(Collection<? extends org.apache.shiro.realm.Realm> realms, org.apache.shiro.authc.AuthenticationToken token) throws org.apache.shiro.authc.AuthenticationException
AuthenticationServiceUnavailableException because this strategy will be re-used for
multiple authentication processes.beforeAllAttempts in interface org.apache.shiro.authc.pam.AuthenticationStrategybeforeAllAttempts in class org.apache.shiro.authc.pam.FirstSuccessfulStrategyorg.apache.shiro.authc.AuthenticationExceptionpublic org.apache.shiro.authc.AuthenticationInfo afterAttempt(org.apache.shiro.realm.Realm realm,
org.apache.shiro.authc.AuthenticationToken token,
org.apache.shiro.authc.AuthenticationInfo singleRealmInfo,
org.apache.shiro.authc.AuthenticationInfo aggregateInfo,
Throwable t)
throws org.apache.shiro.authc.AuthenticationException
AuthenticationServiceUnavailableException, memoize that exception. Will
overwrite any previously memoized exception.afterAttempt in interface org.apache.shiro.authc.pam.AuthenticationStrategyafterAttempt in class org.apache.shiro.authc.pam.AbstractAuthenticationStrategyorg.apache.shiro.authc.AuthenticationExceptionpublic org.apache.shiro.authc.AuthenticationInfo afterAllAttempts(org.apache.shiro.authc.AuthenticationToken token,
org.apache.shiro.authc.AuthenticationInfo aggregate)
throws AuthenticationServiceUnavailableException
AuthenticationServiceUnavailableException, we'll re-throw this exception here.afterAllAttempts in interface org.apache.shiro.authc.pam.AuthenticationStrategyafterAllAttempts in class org.apache.shiro.authc.pam.AbstractAuthenticationStrategyAuthenticationServiceUnavailableException - if none of the attempts was successful and at least one of
them was throwing an exception of this type.Copyright © 2012–2021 Graylog, Inc.. All rights reserved.