1

I want to use the same browser for 2 different users to log into the system, let say one is general user and the other is Admin and they log into the system using the same browser with different tabs. I got a conflict session when trying to do so, the one that log in first was replaced by the other that login after. is there any way to do it without using 2 different browser?

Thanks.

Razeth
  • 69
  • 3
  • 12
  • The browser tabs share the same sessions. There are [workarounds](http://stackoverflow.com/questions/368653/how-to-differ-sessions-in-browser-tabs) to this, but those are bad ideas anyway. Just use two browsers, i.e. chrome and firefox, or use firefox and the other user in "privacy mode" (crtl+shift+p) or implement a ["login-as-user"](http://docs.spring.io/spring-security/site/docs/3.2.5.RELEASE/apidocs/org/springframework/security/web/authentication/switchuser/SwitchUserFilter.html) function. – Stefan Feb 19 '15 at 08:38

1 Answers1

0

The two most widely used ways to track user sessions in Java EE are:

  • Cookies, by storing a cookie named JSESSIONID containing the session ID.
  • URL rewriting, by appending the session ID is to every URL.

When using cookies, since the browser only has one cookie containing the session ID, the session ID is shared by all tabs/windows (excluding incognito/secret windows). So, if you want to get something like this working, you would have to either:

  • Rely on URL rewriting for session tracking
  • Implement your own multi-cookie strategy
Abhijeet Dhumal
  • 1,799
  • 13
  • 24