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

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

Introduction

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

Prototype

public void setAccessDeniedHandler(AccessDeniedHandler accessDeniedHandler) 

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;
}