How to force cAD session end with user logout

Hi all,

We need to add user permissions control depending on user profile to our application. After authentication, we add the user profile to the session context (ILookupContext) and each adapter uses this profile to build the page according the profile.

The problem appears when we need to end the session on user logout. When user clicks the logout button, we clean the user information from the session context and we redirect to the Login page:

public void logout()
	ILookupContext sessionCtx = findSessionContext();
    Login adLogin = (Login) findAdapter(Login.class);

Within this method I want to finish the session and destroy all the adapters. Searching the documentation I’ve found these possibilities
But none of them works.

How can I finish the session? In other words, how can I destroy all the adapters so that the user could change the profile at the Login page and enter into the application with new adapters and not see previous results?

Thanks in advance.

Hi there,

this is a method I implemented for a logout and it works quite ok.

public void doLogout(){

	ArrayList activeGuis;
	String subSessionId;
	IMFWorkplace workplace = (IMFWorkplace)mContext.lookup(IMFWorkplace.IWORKPLACE_LOOKUP, false);
	activeGuis = this.getUserSession().getRegisteredGUISessions();
	Iterator iter = activeGuis.iterator();
	//checkIfPageIsCurrentContentPage(String subSessionId, String pageName, String modelId);

	//Causes a certain frame target to refresh its data content		
	//Remove all pages from workplace
		subSessionId = (String);
	//Refresh left function tree
	//Refresh Browser - call redirect jsp 

Hi Konstantin,

I’m having problems using your piece of code.

  • I can not find the method:
    getUserSession().getRegisteredGUISessions(); (none of them)

  • After this call, the object workplace is null:
    IMFWorkplace workplace = (IMFWorkplace)mContext.lookup(IMFWorkplace.IWORKPLACE_LOOKUP, false);
    We do not use Multi Frame Workplace layouts, we use HTML pages.

Hi there,

actually I put some sample code of our framework as an example.
Let’s take this offline. I wrote you an email.


a very simple way to force the server side session to be removed is to load a plain html document (ie a non framework page) into a frame with ONUNLOADBEHAVIOR==REMOVESESSION. Example: with the given frameset definition…

<mfpage separation="rows" sizing="*">
    <mfcisframe target="AAA" cisurl="/myproject/login.html" unloadbehaviour="REMOVESESSION">

…just call…

openPageInTarget("goodbye.html", "AAA");

…in any page adapter to remove the server side session. Typically you want to provide for the possibility to re-logon. For that just place a button into “goodby.html” that starts the frameset again…

<input type="button" value="Re-logon" onclick="../servlet/StartCISPage?PAGEURL=/myproject/mystarterframesetpage.html">

…where “mystarterframesetpage.html” is the file name of the aboves frameset.