Example usage for org.springframework.security.web.access ExceptionTranslationFilter ExceptionTranslationFilter

List of usage examples for org.springframework.security.web.access ExceptionTranslationFilter ExceptionTranslationFilter

Introduction

In this page you can find the example usage for org.springframework.security.web.access ExceptionTranslationFilter ExceptionTranslationFilter.

Prototype

public ExceptionTranslationFilter(AuthenticationEntryPoint authenticationEntryPoint,
            RequestCache requestCache) 

Source Link

Usage

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

@Bean
public Filter exceptionTranslationFilter(RequestCache requestCache) {
    AccessDeniedHandlerImpl accessDeniedHandler = new AccessDeniedHandlerImpl();
    accessDeniedHandler.setErrorPage(applicationUrl("/access-denied"));
    LoginUrlAuthenticationEntryPoint authenticationEntryPoint = new LoginUrlAuthenticationEntryPoint(
            applicationUrl("/login"));
    ExceptionTranslationFilter exceptionTranslationFilter = new ExceptionTranslationFilter(
            authenticationEntryPoint, requestCache);
    exceptionTranslationFilter.setAccessDeniedHandler(accessDeniedHandler);
    return exceptionTranslationFilter;
}