Skip to main content link. Accesskey S
  • Log In
  • Help
  • IBM Logo
  • IBM Digital Experience wiki
  • All Wikis
  • All Forums
  • ANNOUNCEMENT: WIKI CHANGE TO READ-ONLY. LEARN MORE...
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • IBM Redbooks
  • API Documentation
Search
Community Articles > IBM Web Content Manager > Best Practices for Web Content Manager > Restricting Multiple Sessions in WebSphere Portal
  • New Article
  • Share Show Menu▼
  • Subscribe Show Menu▼

About the Original Author

Click to view profileJohn Munnell
Contribution Summary:
  • Articles authored: 4
  • Articles edited: 8
  • Comments Posted: 1

Recent articles by this author

Customizing the WCM Authoring Templates for Portal

In Lotus Web Content Management (WCM) one of the key requirements is to offer a simple and easy to use authoring interface which can provide better user experience which also helps to save time and effort. This article talks about a few ways to customize the Authoring Template (AT) to provide ...

Best Practices for IBM Mobile Portal Accelerator Design (WebSphere Everyplace Mobile Portal)

IBM Mobile Portal Accelerator greatly reduces the development effort required to get a mobile portal up and running to support thousands of devices. However, there are certain UI design guidelines which, if followed, result in a cleaner design, easier development, and optimized UI. Here are some ...

Restricting multiple simultaneous sessions in IBM WebSphere Portal

When an IBM® WebSphere® Portal user creates multiple, simultaneous sessions, it can create problems for transactional applications, such as those in the banking industry. This article explains two approaches to controlling multiple sessions from the same user in WebSphere Portal V6.0 and V6.1 ...

Creating forms in WEMPe

Authors: Preeti Sharma (sharma.preeti@in.ibm.com) Kiran Rao (kiran.rao@in.ibm.com) Introduction IBM WebSphere Everyplace Mobile Portal enable (WEMPe) is a product which extends WebSphere Portal to deliver optimized web content to a wide range of mobile handsets. WEMPe follows a “write once, ...
Community articleRestricting Multiple Sessions in WebSphere Portal
Added by John Munnell | Edited by IBM contributorJohn Munnell on March 15, 2010 | Version 9
expanded Abstract
collapsed Abstract
This article addresses problem when user logs in at once from multiple places. For example consider these scenarios:- In portal, session is tracked by cookie using JSessionID. If you open a new window from existing browser window then cookie is propagated so portal maintains same session however opening a different browser instance does not propagate cookie so it creates a new session at portal end. It means user can establish two sessions at the same time from one machine. With the increased usage of smart mobile devices, user logging in at once from multiple places is becoming a commonplace. These types of scenarios bring data inconsistency issues that should be thought through in the architecture. Consider example of banking portal where multiple sessions per user needs to be handled efficiently. This article addresses this problem efficiently in context of both the versions of portal, WebSphere Portal Server V6.0 and WebSphere Portal Server V6.1.
Tags: portal login multiple sessions
Problem Statement

WebSphere Portal provides many ways to configure a variety of security scenarios. Sometime it becomes necessary to customize or extend the default product capabilities for login, logout, or session handling.

Session management in portal is handled optimally by portal engine. In case of Anonymous user access, portal can optionally create sessions for user access. In case of registered users, portal creates user session after user is successfully authenticated.

This article addresses problem when user logs in at once from multiple places. For example consider these scenarios:-
In portal, session is tracked by cookie using JSessionID. If you open a new window from existing browser window then cookie is propagated so portal maintains same session however opening a different browser instance does not propagate cookie so it creates a new session at portal end. It means user can establish two sessions at the same time from one machine.
With the increased usage of smart mobile devices, user logging in at once from multiple places is becoming a commonplace.
These types of scenarios bring data inconsistency issues that should be thought through in the architecture. Consider example of banking portal where multiple sessions per user needs to be handled efficiently.

This article addresses this problem efficiently in context of both the versions of portal, WebSphere Portal Server V6.0 and WebSphere Portal Server V6.1.

Terms to Note:
Throughout the article I would be using some terms like ‘first user’ or ‘second user’, these users are defined as channel specific user.
The term ‘first user’ means user ‘x’ logging in using 1 channel.
The term ‘second user’ means user ‘x’ logging in using 2nd channel.
They refer to ‘same’ user ‘x’.

Solution Overview

This article will talk about how to control multiple sessions of same user in portal implementations. In portal we cannot get hold of logged-in user sessions due to security constraints. When same user logs in from multiple places we cannot automatically logout every other logged-in user from portal but we can force log-out user upon duplicate session detection writing custom logic. [Force Log-out]Redirect user to a blank page with Log-out button only.

There are two approaches to resolve multiple sessions of same user:-
  • Allow second user to log-in whereas force first user to log-out session from portal.
  • Force second user to log-out as first user has already logged-in.

This article will discuss solution to both the solution approaches as stated above. It will also discuss pros and cons of both the approaches in detail.

Approach – 1: Force first user to log-out session from portal

Solution
In this approach we will allow second user to successfully log-in to the system, whereas we force log-out first user session from the server.

Figure – 1, User Login Flow
User Login Flow - Approach 1

Steps
We track user session in server using database and in-memory cache module. The reason for choosing database is that it is common across all cluster members. Database module is referred during login process and cache module is referred on every other request then login per user session.
Algorithm is executed after user has successfully logged-in during portal post login module.
In Portal V6.0, we may need to write post login module where we will track user session. Please refer article  HYPERLINK "http://www-01.ibm.com/support/docview.wss?uid=swg21263681&aid=3" http://www-01.ibm.com/support/docview.wss?uid=swg21263681&aid=3 for more details.
In Portal V6.1, we write ExplicitLoginFilter to write post login module. Please refer article  HYPERLINK "http://www.ibm.com/developerworks/websphere/library/techarticles/0905_buchwald/0905_buchwald.html" http://www.ibm.com/developerworks/websphere/library/techarticles/0905_buchwald/0905_buchwald.html for more details.
We have used Database to track user entity, we can also use User registry configured with Portal server to track user logged-in status. DB table structure is like this:-
 
| CustomerID | VarChar
SessionID VarChar
| Node IP | VarChar
Timestamp VarChar
 
In case of cluster, node ip will be server name. Database can help us detect duplicate sessions, but it cannot help us log-out user.
 
As soon as we detect second user has logged in we update in-memory cache and send log-out for first user to all servers in cluster. User request flow and Remote log-out module is explained below in flow-chart. We updated in-memory cache module to reflect new session has been established for user ‘x’.
 
Whenever first user accesses the system next time, in-memory cache is checked to validate session status, if his session is not valid then we log-out this user from portal server.

Figure -2, User Normal Request Flow
User Normal Request Flow


Figure -3, Remote Log-out Flow
Remote Log-out Flow


        
Implementation Details
We will send remote logout request to all cluster members in cluster. Remote Log-out request will look like:-  HYPERLINK "http:///action/logout.action?customerid=&sessionid=/action/logout.action?customerid=&sessionid=
Remote Log-out request will be server-to-server forward and no redirect.
Remote Log-out Module is implemented as servlet. This module should be deployed on all the nodes in cluster.
When user accesses the system whether user is logged-in or not, its status is checked against cache, all this logic should be implemented in Servlet Filter on top of portal servlet. The reason being, the Filter will always execute on each request.
We used database to check whether user has logged in or not, implementers can use LDAP or portal configured repository to maintain this status. Fields and attributes are required as specified above.
While Logging-out first user from portal we are showing page with warning message and when the user will click on Ok, he is logged-out. This behavior can be overridden to directly log-out user without showing warning message.
In-Memory Cache is implemented using Dyna-Cache. Key in cache is userId whereas its value is sessionID and NodeIP.
In-Memory Cache is not shared across nodes in cluster.
On every request cache entry is touched so as to keep its TTL beyond session idle time-out.
Session Invalidation Listener should be implemented on portal server to clean in-memory state from cache on session invalidation.
We are not using Timestamp column in DB Table but has been kept there for future requirements.

Performance Implications

On every Login request we have now introduced new hob i.e. DB for processing.
In-memory cache is referred on every request per session.
If user closes the browser window then its session is not invalidated from in-memory cache. It will be maintained in memory for session idle time-out, after that it is automatically evicted out from cache.

Limitation
Session Affinity has to be enabled for this implementation. Session Affinity is enabled at “IHS” level, which means request for same session will land on node which establishes the session.

Approach – 2: Disallow second user to log-in

Solution
In this approach we will not allow second user to log-in to the system, as first user has logged into the system.

Figure – 4 User Login Flow
User Login Flow - Approach 2


Algorithm
We track user session in server using Database module.
Algorithm is executed after user has successfully logged-in during portal post login module.
As soon as we detect second user has logged in we check DB for its status and if first user has already logged-in and its time is less then session idle time-out then we dis-allow this user from logging in. We will redirect user to a blank page with Log-out button from portal post login module.
If user entry exist in DB then timestamp is checked for session idle time-out, if it is beyond session idle time-out then user is allowed to log-in.
When user accesses the system whether user is logged-in or not it status is checked against DB, all this logic should be implemented in Servlet Filter on top of portal servlet. The reason being is Filter will always execute on each request.
We used database to check whether user has logged in or not, we can also use LDAP or portal configured repository to maintain this status. Fields and attributes required are specified above.
On every request DB Timestamp entry is touched so as to keep its TTL beyond session idle time-out.
Session Invalidation Listener should be implemented on portal server to clean Timestamp, sessionID state from cache on session invalidation.
Algorithm of updating DB entry is implemented after user has successfully logged-in. It should be implemented in custom Portal login/logout extension.
DB table details are as under:-
 
Column Name Data Type
| CustomerID | VarChar
 SessionID | VarChar
Timestamp VarChar

Performance Implications
On every request we have now introduced new hob i.e. DB for processing. Database user record is processed on each request. Timestamp is updated with new interaction time in DB.

Limitation
If user closes the browser window then its Timestamp is not invalidated in DB. It will be maintained in DB for session idle time-out, which essentially means same user cannot login for period less then session idle time-out.

expanded Attachments (4)
collapsed Attachments (4)
File TypeSizeFile NameCreated OnDelete file
image/jpeg 33 KB Fig_1.JPG 3/15/10, 5:20 PM
image/jpeg 16 KB Fig_2.JPG 3/15/10, 5:20 PM
image/jpeg 15 KB Fig_3.JPG 3/15/10, 5:20 PM
image/jpeg 31 KB Fig_4.JPG 3/15/10, 5:20 PM
expanded Versions (17)
collapsed Versions (17)
Version Comparison     
VersionDateChanged by              Summary of changes
17Apr 14, 2010, 10:46:28 AMLeslie Gallo  IBM contributor
16Apr 14, 2010, 10:30:35 AMLeslie Gallo  IBM contributor
15Apr 14, 2010, 9:57:01 AMLeslie Gallo  IBM contributor
14Apr 14, 2010, 9:50:37 AMLeslie Gallo  IBM contributor
13Apr 7, 2010, 2:11:23 PMJohn Munnell  IBM contributor
12Mar 16, 2010, 8:41:34 AMJohn Munnell  IBM contributor
11Mar 15, 2010, 5:53:04 PMJohn Munnell  IBM contributor
10Mar 15, 2010, 5:51:54 PMJohn Munnell  IBM contributor
This version (9)Mar 15, 2010, 5:48:53 PMJohn Munnell  IBM contributor
8Mar 15, 2010, 5:47:23 PMJohn Munnell  IBM contributor
7Mar 15, 2010, 5:46:03 PMJohn Munnell  IBM contributor
6Mar 15, 2010, 5:45:14 PMJohn Munnell  IBM contributor
5Mar 15, 2010, 5:33:46 PMJohn Munnell  IBM contributor
4Mar 15, 2010, 5:30:40 PMJohn Munnell  IBM contributor
3Mar 15, 2010, 5:27:13 PMJohn Munnell  IBM contributor
2Mar 15, 2010, 5:23:55 PMJohn Munnell  IBM contributor
1Mar 15, 2010, 5:17:13 PMJohn Munnell  IBM contributor
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedHelpAbout
  • IBM Collaboration Solutions wikis
  • IBM developerWorks
  • IBM Software support
  • Twitter LinkIBMSocialBizUX on Twitter
  • FacebookIBMSocialBizUX on Facebook
  • ForumsLotus product forums
  • BlogsIBM Social Business UX blog
  • Community LinkThe Social Lounge
  • Wiki Help
  • Forgot user name/password
  • About the wiki
  • About IBM
  • Privacy
  • Accessibility
  • IBM Terms of use
  • Wiki terms of use