我扩展了UsernamePasswordAuthenticationFilter,它包含以下方法:
@Override
protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response,
FilterChain chain, Authentication authResult) throws IOException, ServletException {
customAuthenticationPlugin.execute(userInfo, (AuthenticatedAuthenticationToken) authResult);
super.successfulAuthentication(request, response, chain, authResult);
}
我该如何定义,在安全过程中发生任何异常时,它应该被重定向到某个错误页面?
更新:
在我的web.xml文件,但它不起作用。可能是因为春天的安全
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>