Java Code Examples for org.springframework.security.web.access.AccessDeniedHandlerImpl#setErrorPage()
The following examples show how to use
org.springframework.security.web.access.AccessDeniedHandlerImpl#setErrorPage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebSecurityBeanConfig.java From webauthn4j-spring-security with Apache License 2.0 | 7 votes |
@Bean public AccessDeniedHandler accessDeniedHandler() { LinkedHashMap<Class<? extends AccessDeniedException>, AccessDeniedHandler> errorHandlers = new LinkedHashMap<>(); // invalid csrf authenticator error handler AccessDeniedHandlerImpl invalidCsrfTokenErrorHandler = new AccessDeniedHandlerImpl(); invalidCsrfTokenErrorHandler.setErrorPage("/api/status/403"); errorHandlers.put(InvalidCsrfTokenException.class, invalidCsrfTokenErrorHandler); // missing csrf authenticator error handler AccessDeniedHandlerImpl missingCsrfTokenErrorHandler = new AccessDeniedHandlerImpl(); missingCsrfTokenErrorHandler.setErrorPage("/api/status/403"); errorHandlers.put(MissingCsrfTokenException.class, missingCsrfTokenErrorHandler); // default error handler AccessDeniedHandlerImpl defaultErrorHandler = new AccessDeniedHandlerImpl(); defaultErrorHandler.setErrorPage("/api/status/403"); return new DelegatingAccessDeniedHandler(errorHandlers, defaultErrorHandler); }
Example 2
Source File: WebSecurityBeanConfig.java From webauthn4j-spring-security with Apache License 2.0 | 6 votes |
@Bean public AccessDeniedHandler accessDeniedHandler() { LinkedHashMap<Class<? extends AccessDeniedException>, AccessDeniedHandler> errorHandlers = new LinkedHashMap<>(); // invalid csrf authenticator error handler AccessDeniedHandlerImpl invalidCsrfTokenErrorHandler = new AccessDeniedHandlerImpl(); invalidCsrfTokenErrorHandler.setErrorPage("/api/status/403"); errorHandlers.put(InvalidCsrfTokenException.class, invalidCsrfTokenErrorHandler); // missing csrf authenticator error handler AccessDeniedHandlerImpl missingCsrfTokenErrorHandler = new AccessDeniedHandlerImpl(); missingCsrfTokenErrorHandler.setErrorPage("/api/status/403"); errorHandlers.put(MissingCsrfTokenException.class, missingCsrfTokenErrorHandler); // default error handler AccessDeniedHandlerImpl defaultErrorHandler = new AccessDeniedHandlerImpl(); defaultErrorHandler.setErrorPage("/api/status/403"); return new DelegatingAccessDeniedHandler(errorHandlers, defaultErrorHandler); }
Example 3
Source File: SecurityConfig.java From Spring with Apache License 2.0 | 5 votes |
@Bean public ExceptionTranslationFilter exceptionTranslationFilter() { final AuthenticationEntryPoint loginUrlAuthenticationEntryPoint = new LoginUrlAuthenticationEntryPoint("/login.jsp"); final AccessDeniedHandlerImpl accessDeniedHandlerImpl = new AccessDeniedHandlerImpl(); accessDeniedHandlerImpl.setErrorPage("/accessDenied.jsp"); final ExceptionTranslationFilter eTranslationFilter = new ExceptionTranslationFilter(loginUrlAuthenticationEntryPoint); eTranslationFilter.setAccessDeniedHandler(accessDeniedHandlerImpl); return eTranslationFilter; }
Example 4
Source File: AjaxSupportedAccessDeniedHandler.java From onetwo with Apache License 2.0 | 4 votes |
@Override public void afterPropertiesSet() throws Exception { AccessDeniedHandlerImpl adh = new AccessDeniedHandlerImpl(); adh.setErrorPage(errorPage); this.delegateAccessDeniedHandler = adh; }