0

I am developing spring MVC application, in my project, i have login page where I can successfully log in, the problem is that if I open new tab and log in with different username it's logging in, means at a time in the same browser I am able to login in multiple users which I don't want ,I want my application to single user login per browser how to make it.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Ravi
  • 11
  • 2

2 Answers2

0

While rendering login page, you check authentication. If you are using Spring security, you can check for principal auth present or not. If auth is present render home page else render login page. I think this can solve your issue neatly.

Valath
  • 880
  • 3
  • 13
  • 35
0

I suppose that Spring Security session management is what you're looking for:

Spring Security is able to prevent a principal from concurrently authenticating to the same application more than a specified number of times. Many ISVs take advantage of this to enforce licensing, whilst network administrators like this feature because it helps prevent people from sharing login names. You can, for example, stop user “Batman” from logging onto the web application from two different sessions. You can either expire their previous login or you can report an error when they try to log in again, preventing the second login.

For more information, read the following docs:

Slava Semushin
  • 14,904
  • 7
  • 53
  • 69