简体   繁体   中英

login/logout with same LoginId

I have developed a web app with Struts and Hibernet .

Now i want to make login mechanism like as :

Suppose user A login with login id A ==> it will allow to login

now at same time User B login with login id A ==> it also allow to login but previous login User A will be logout and latest login user B is active....

In simple word LOGIN WITH SAME LOGINID WILL ALLOW BUT LATEST ONE IS ACTIVE AND PREVIOUS ONE IS LOGOUT AUTOMATICALLY.....??

i have manage sessionID and loginID with hashtable ...

I dont want to use database mechanism ....

I hope u got my question .. PLs help me ...!!! Thanks in advance....

I assume its Single Sign On, similar to the login process we find in Yahoo Messenger.

Following steps might help you in developing the same

  • Implement no-cache policy [ Setting no-cache headers to response ]
  • Store user_id to session id, or last_login time etc in database
  • Instead of holding user login information in session , storing it in cache will be helpful
  • If new user logs in with same id, just nullify previous session in the cache, this makes other user who has already logged in for forceful logout [ Assuming you check user login status for every request]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM