我正在使用华夫饼 1.7 + spring 4 + spring security 3.2 + thymeleaf。我的问题是,当回退表单日志记录失败时,我无法提供自定义错误页面。这是我的配置:
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/**")
.authenticated()
.and()
.exceptionHandling()
.authenticationEntryPoint(negotiateSecurityFilterEntryPoint())
.accessDeniedPage("/access-denied")
.and()
.addFilterBefore(waffleNegotiateSecurityFilter(),
BasicAuthenticationFilter.class);
}
当用户在关闭 SNPENGO 的情况下使用浏览器并输入错误的凭据时,会出现默认的系统 500 页面,其中包含以下信息:
com.sun.jna.platform.win32.Win32Exception: The logon attempt failed. waffle.windows.auth.impl.WindowsAuthProviderImpl.acceptSecurityToken(WindowsAuthProviderImpl.java:134)
waffle.servlet.spi.NegotiateSecurityFilterProvider.doFilter(NegotiateSecurityFilterProvider.java:103) waffle.servlet.spi.SecurityFilterProviderCollection.doFilter(SecurityFilterProviderCollection.java:130)
...
如何提供我的自定义页面(access-denied.html thymeleaf 模板)?到目前为止,我已经尝试了http://spring.io/blog/2013/11/01/exception-handling-in-spring-mvc中的所有内容,但没有成功。