org.springframework.security.authentication
Class DefaultAuthenticationEventPublisher

java.lang.Object
  extended by org.springframework.security.authentication.DefaultAuthenticationEventPublisher
All Implemented Interfaces:
ApplicationEventPublisherAware, AuthenticationEventPublisher

public class DefaultAuthenticationEventPublisher
extends Object
implements AuthenticationEventPublisher, ApplicationEventPublisherAware

The default strategy for publishing authentication events.

Maps well-known AuthenticationException types to events and publishes them via the application context. If configured as a bean, it will pick up the ApplicationEventPublisher automatically. Otherwise, the constructor which takes the publisher as an argument should be used.

The exception-mapping system can be fine-tuned by setting the additionalExceptionMappings as a java.util.Properties object. In the properties object, each of the keys represent the fully qualified classname of the exception, and each of the values represent the name of an event class which subclasses AbstractAuthenticationFailureEvent and provides its constructor. The additionalExceptionMappings will be merged with the default ones.

Since:
3.0
Version:
$Id: DefaultAuthenticationEventPublisher.java 3984 2009-11-17 12:55:53Z ltaylor $
Author:
Luke Taylor

Constructor Summary
DefaultAuthenticationEventPublisher()
           
DefaultAuthenticationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
           
 
Method Summary
 void publishAuthenticationFailure(AuthenticationException exception, Authentication authentication)
           
 void publishAuthenticationSuccess(Authentication authentication)
           
 void setAdditionalExceptionMappings(Properties additionalExceptionMappings)
          Sets additional exception to event mappings.
 void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAuthenticationEventPublisher

public DefaultAuthenticationEventPublisher()

DefaultAuthenticationEventPublisher

public DefaultAuthenticationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
Method Detail

publishAuthenticationSuccess

public void publishAuthenticationSuccess(Authentication authentication)
Specified by:
publishAuthenticationSuccess in interface AuthenticationEventPublisher

publishAuthenticationFailure

public void publishAuthenticationFailure(AuthenticationException exception,
                                         Authentication authentication)
Specified by:
publishAuthenticationFailure in interface AuthenticationEventPublisher

setApplicationEventPublisher

public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher)
Specified by:
setApplicationEventPublisher in interface ApplicationEventPublisherAware

setAdditionalExceptionMappings

public void setAdditionalExceptionMappings(Properties additionalExceptionMappings)
Sets additional exception to event mappings. These are automatically merged with the default exception to event mappings that ProviderManager defines.

Parameters:
additionalExceptionMappings - where keys are the fully-qualified string name of the exception class and the values are the fully-qualified string name of the event class to fire.


Copyright © 2004-2009 SpringSource, Inc. All Rights Reserved.