【发布时间】:2016-09-09 21:21:18
【问题描述】:
我的删除 cookie 的试用代码
.logout()
.logoutUrl("/access/logout")
.logoutSuccessHandler(new LogoutSuccessHandler() {
@Override
public void onLogoutSuccess(
HttpServletRequest request,
HttpServletResponse response,
Authentication a) throws IOException, ServletException {
response.setStatus(HttpServletResponse.SC_NO_CONTENT);
}
})
.deleteCookies("JSESSIONID")
.invalidateHttpSession(true)
这是HttpSecurity的注销安全代码
在这里我遇到了删除 cookie 的问题
在 logoutSuccessHandler 在记录器中它显示 cookies = 1 并且即 JESSESIONID
所以我的问题是如何在注销时删除 cookie
或者如果有任何其他方式或任何角度的方式那么请告诉我
【问题讨论】:
-
使http会话失效就足够了。在此之后 JSESSION_ID 不再有效。我你真的想删除它,你可能想在客户端使用 $cookies 角度服务,但只有在服务器端取消会话之后
-
好的,如果我想在 angularJs 端清除它,我应该怎么做
-
贴出注销涉及的ng代码。
标签: angularjs spring cookies spring-security