[英]How to log out a user from a GWT application?
I develop an GWT applicationwith HTTP basic login type. 我用HTTP基本登录类型开发了一个GWT应用程序。
I have a "Logout" button that calls a server side method logout() 我有一个“注销”按钮,它调用服务器端方法logout()
public void logout() {
getThreadLocalRequest().getSession().invalidate();
}
after the call it executes 调用后执行
Cookies.removeCookie("JSESSIONID");
Window.Location.reload();
in order to reload the page and get a browser's login screen. 为了重新加载页面并获得浏览器的登录屏幕。
But when the page reloads, I'm still logged in. Why ? 但是,当页面重新加载时,我仍然登录。为什么?
Well, Logout is a common problem for basic HTTP authentication. 嗯,注销是基本HTTP身份验证的常见问题。
Ref. 参考 Logout with http basic authentication and restful_authentication plugin
使用http基本身份验证和restful_authentication插件注销
if the user logs in with basic auth, he/she will have to close his/her browser window to logout.
如果用户使用基本身份验证登录,则他/她将必须关闭其浏览器窗口才能注销。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.