Hai我可以向Spring Security Logout添加参数。我在security.xml中配置了logout请求,如下所示。
<sec:logout invalidate-session="true" logout-success-url="/logoutsuccess.do" logout-url="/logout.do" />
答案 0 :(得分:2)
编写自定义注销处理程序。将属性success-handler-ref放在xml配置文件中。
e.g
<sec:logout invalidate-session="true" logout-success-url="/logoutsuccess.do"
logout-url="/logout.do"
success-handler-ref="YourCustomLogoutSuccessHandler"/>
然后扩展SimpleUrlLogoutSuccessHandler或实施LogoutHandler。
e.g
public class YourCustomLogoutSuccessHandler extends SimpleUrlLogoutSuccessHandler {
@Override
public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException, ServletException {
//Do what you want to do here
//.......
//below does the 'standard' spring logout handling
super.onLogoutSuccess(request, response, authentication);
}
}
另一种方法是here。这还显示了如何重定向到特定URL并手动处理会话管理。