aspose file tools*
The moose likes Struts and the fly likes how to restrict concurrent logins Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to restrict concurrent logins" Watch "how to restrict concurrent logins" New topic
Author

how to restrict concurrent logins

venkateshwar rao ravula
Greenhorn

Joined: Apr 03, 2006
Posts: 15
Hi All,

how to prevent concurrent logins in struts application

what exaclty i mean is if user enters into application,session has been created for that particular user. if the same user logs into the application from the same system or another system session that has already exists for that pariculr user sholud be invalidated.

Thanks & regards,

Venkateshwar Rao Ravula
John Melton
Ranch Hand

Joined: Aug 17, 2004
Posts: 49
Probably multiple ways to do this, but here's one idea.
1. Have a database table like CURRENT_SESSIONS that holds the user information and the most recent login time
2. Every time a user attempts to login, check this table to see if the user currently has a session in there. If not, insert a new record in the table, store the userid in the session and let the user login. If there is a record for that user in the table, do not let the user login and take them to an error page informing them about the error.
3. On logout or session timeout (configured in web.xml), get the username of the user that's currently logged in from the session, and remove any record from the CURRENT_SESSIONS table for that user so that he can login the next time).

Hope this helps


[url]www.jtmelton.com[/url]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to restrict concurrent logins
 
Similar Threads
How to find out end of session?
session isnew()
Time record for jsp
Prevent multiple concurrent logins from same user in clustered env
how to test web application