Stop causing an exception when there is no AuthenticationException to ApplicationEvent mapping. Requested by Brian Moseley on acegisecurity-developer 10 November 2005.

This commit is contained in:
Ben Alex 2005-11-10 00:41:54 +00:00
parent c167e9fd87
commit b1d247835a
1 changed files with 9 additions and 5 deletions

View File

@ -200,7 +200,7 @@ public class ProviderManager extends AbstractAuthenticationManager
exceptionMappings.put(BadCredentialsException.class.getName(), exceptionMappings.put(BadCredentialsException.class.getName(),
AuthenticationFailureBadCredentialsEvent.class.getName()); AuthenticationFailureBadCredentialsEvent.class.getName());
exceptionMappings.put(UsernameNotFoundException.class.getName(), exceptionMappings.put(UsernameNotFoundException.class.getName(),
AuthenticationFailureBadCredentialsEvent.class.getName()); AuthenticationFailureBadCredentialsEvent.class.getName());
exceptionMappings.put(ConcurrentLoginException.class.getName(), exceptionMappings.put(ConcurrentLoginException.class.getName(),
AuthenticationFailureConcurrentLoginEvent.class.getName()); AuthenticationFailureConcurrentLoginEvent.class.getName());
exceptionMappings.put(ProviderNotFoundException.class.getName(), exceptionMappings.put(ProviderNotFoundException.class.getName(),
@ -295,10 +295,14 @@ public class ProviderManager extends AbstractAuthenticationManager
catch (InvocationTargetException ignored) {} catch (InvocationTargetException ignored) {}
} }
Assert.notNull(event, if (event != null) {
"A valid event must be available for the exception " applicationEventPublisher.publishEvent(event);
+ lastException.getClass().getName()); } else {
applicationEventPublisher.publishEvent(event); if (logger.isDebugEnabled()) {
logger.debug("No event was found for the exception "
+ lastException.getClass().getName());
}
}
// Throw the exception // Throw the exception
throw lastException; throw lastException;