Example usage for org.springframework.security.authentication ProviderManager setMessageSource

List of usage examples for org.springframework.security.authentication ProviderManager setMessageSource

Introduction

In this page you can find the example usage for org.springframework.security.authentication ProviderManager setMessageSource.

Prototype

public void setMessageSource(MessageSource messageSource) 

Source Link

Usage

From source file:ru.anr.base.services.SecurityConfig.java

/**
 * Defining a {@link AuthenticationManager} bean
 * //from w w w .  j  a  va  2  s. com
 * @param messageSource
 *            Message source instance
 * @return A bean instance
 * 
 * @throws Exception
 *             In case of ProviderManager initialization error
 */
@Bean(name = "authenticationManager")
@DependsOn("messageSource")
public AuthenticationManager authenticationManager(MessageSource messageSource) throws Exception {

    ProviderManager providerManager = new ProviderManager(providers);
    providerManager.setMessageSource(messageSource);
    providerManager.setAuthenticationEventPublisher(new DefaultAuthenticationEventPublisher());

    providerManager.afterPropertiesSet();
    return providerManager;
}