views:

105

answers:

1

I am working in websphere 7.0. I use the security from the application server. I would like to removing the association with the user, so user is redirected to the login page before accessing a secure resource (and request.getUserPrincipal() returns null).

I try :

request.getSession().invalidate();

but the user principal is still associated.

How could I remove that association?

+1  A: 

On websphere, a special logout form calles must be used :

http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/tsec_pofolo.html

Here what I am using :

<body onload="javascript:document.logout.submit()">
    <h2>Sample Form Logout</h2>
    <form METHOD=POST ACTION="ibm_security_logout" NAME="logout">
    Click this button to log out:
    <input type="submit" name="logout" value="Logout">
    <INPUT TYPE="HIDDEN" name="logoutExitPage" VALUE="/some url">
    </form>
</body>
Guillaume Coté
No, it *must* not. As per the documentation it's just a convenience way to logout without the need to invalidate the "whole" session.
BalusC
Invalidating the session was not working, the user principal was still present. If you have a better way to do it, I would like to know.
Guillaume Coté
ibm_security_logout is not just a shortcut for invalidating the session it does the following: 1. Clears the Lightweight Third Party Authentication (LTPA) / single sign-on (SSO) cookies 2. Invalidates the HTTP session 3. Removes the user from the authentication cache. Even if your session is invalidated when calling HttpSession#invalidate() it is not sufficient. Your LTPA cookie remains valid and allows you to access applications using SSO without login in, and that is why you must call ibm_security_logout.
svachon