Example usage for org.springframework.security.web.authentication SavedRequestAwareAuthenticationSuccessHandler setRequestCache

List of usage examples for org.springframework.security.web.authentication SavedRequestAwareAuthenticationSuccessHandler setRequestCache

Introduction

In this page you can find the example usage for org.springframework.security.web.authentication SavedRequestAwareAuthenticationSuccessHandler setRequestCache.

Prototype

public void setRequestCache(RequestCache requestCache) 

Source Link

Usage

From source file:org.lightadmin.core.config.context.LightAdminSecurityConfiguration.java

@Bean
@Autowired/*w w w. java  2  s .  co  m*/
public Filter authenticationFilter(AuthenticationManager authenticationManager, RequestCache requestCache) {
    UsernamePasswordAuthenticationFilter authenticationFilter = new UsernamePasswordAuthenticationFilter();
    authenticationFilter.setFilterProcessesUrl(applicationUrl("/j_spring_security_check"));
    authenticationFilter.setAuthenticationManager(authenticationManager);
    SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
    successHandler.setRequestCache(requestCache);
    authenticationFilter.setAuthenticationSuccessHandler(successHandler);
    authenticationFilter.setAuthenticationFailureHandler(
            new SimpleUrlAuthenticationFailureHandler(applicationUrl("/login?login_error=1")));
    return authenticationFilter;
}