Search in sources :

Example 1 with AbstractAuthenticationEvent

use of org.springframework.security.authentication.event.AbstractAuthenticationEvent in project spring-security by spring-projects.

the class DefaultAuthenticationEventPublisher method publishAuthenticationFailure.

public void publishAuthenticationFailure(AuthenticationException exception, Authentication authentication) {
    Constructor<? extends AbstractAuthenticationEvent> constructor = exceptionMappings.get(exception.getClass().getName());
    AbstractAuthenticationEvent event = null;
    if (constructor != null) {
        try {
            event = constructor.newInstance(authentication, exception);
        } catch (IllegalAccessException ignored) {
        } catch (InstantiationException ignored) {
        } catch (InvocationTargetException ignored) {
        }
    }
    if (event != null) {
        if (applicationEventPublisher != null) {
            applicationEventPublisher.publishEvent(event);
        }
    } else {
        if (logger.isDebugEnabled()) {
            logger.debug("No event was found for the exception " + exception.getClass().getName());
        }
    }
}
Also used : AbstractAuthenticationEvent(org.springframework.security.authentication.event.AbstractAuthenticationEvent) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 AbstractAuthenticationEvent (org.springframework.security.authentication.event.AbstractAuthenticationEvent)1