本文介绍了擦除websphere中的cookie - 如何注销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用另一个网页,通过URL将用户认证(AD登录)传递给WebSphere。当我注销时,我重定向到登录页面,并且已经登录,因为我的会话从未关闭。我尝试了几个东西来禁用与WebSphere的cookie,但没有什么工作。有一个简单的方法来删除与java代码的cookie,当我按退出按钮?任何帮助是非常感谢。

I am using another webpage that passes the user authentication( AD login ) to WebSphere by URL. When I am logging out I am redirecting towards the log-in page and is already logged in since my session is never closed. I tried a few things to disable the cookie with WebSphere but nothing worked. Is there an easy way to delete the cookies with a java code when I press the log out button? Any help is very appreciated.

推荐答案

如果您使用WebSphere 8.x,您应该使用servlet 3.0 api和方法,然后重定向到注销页面。

If you are using WebSphere 8.x you should use servlet 3.0 api and the request.logout() method, before you are doing redirection to the logout page. This method will remove session and authentication cookies.

对于较旧的WebSphere版本/ servlet api,请使用以下(在WAS v8中已弃用):

For older WebSphere versions/ servlet api use the following (deprecated in WAS v8):

try {
    WSSecurityHelper.revokeSSOCookies(req, res);
    } catch(Exception e) {
    ...
}

UPDATE

对于v7,我建议使用form-logout。
如果要注销表单应用程序,您创建以下注销表单,或创建自定义发布到 ibm_security_logout ,您可以使用 logoutExitPage 在注销后重定向到所需页面:

UPDATE
For v7 I'd recommend form-logout.If you want to logout form application you create the following logout form, or create custom post to the ibm_security_logout you can use logoutExitPage to redirect to desired page after logout:

<h2>Sample Form Logout</h2>
<FORM METHOD=POST ACTION="ibm_security_logout" NAME="logout">
    <input type="submit" name="logout" value="Logout">
    <INPUT TYPE="HIDDEN" name="logoutExitPage" VALUE="/login.html">
</form>

有关详细信息,请参阅

For more details see Customizing login/logout

如果您无法使用此表单注销,请使用 WSSecurityHelper.revokeSSOCookies(req,res),如上面的servlet中所示。

If you cannot use this form logout then use the WSSecurityHelper.revokeSSOCookies(req, res) as shown above in your servlet.

这篇关于擦除websphere中的cookie - 如何注销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 23:17