File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Preventing multiple logins Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Preventing multiple logins " Watch "Preventing multiple logins " New topic
Author

Preventing multiple logins

Alexan Kahkejian
Ranch Hand

Joined: Apr 30, 2003
Posts: 74
Hi all

In my application I implemented this solution to prevent multiple logins from the same user:

In the application scope I store:
a- the user name (key) and sessionID(value).
b- sessionID(key) and an object(value) which is of the following class:


And I have a session listener which removes the values stored in the application scope in the sessionDestroyed method.

So when the user logs in I check if this user name exists in the application scope and if so I get the session id associated with it and finally I retrieve the object associated with sessionID which holds the reference to the real session object and I call invalidate() on it.

After that I insert the (username, sessionID) and (sessionID, Reference) to the application scope.


The problem is that I believe that there are better solutions than this so any ideas are so much appreciated.


P.S. : I am using Struts 1.1

Thanks in advance


Alexan Kahkejian<br />SCJP<br />SCWCD<br /><a href="http://www.javaemployer.com" target="_blank" rel="nofollow">http://www.javaemployer.com</a>
 
wood burning stoves
 
subject: Preventing multiple logins
 
Similar Threads
Doubt from the JSP Spec
How to invalidate a user session, when I only have a session ID?
Passing parameter from Web UI to RCP
screwy problem with sessions/windows
Preventing multiple logins