Question

I have the client on Flash and the server on Spring. I want to prevent user from log in twice using the same account, using two browsers. So when user will log in, server should check if there is the active session for this user, and destroy it.
So, there is the question, what is the best way to destroy another session in Spring?

Was it helpful?

Solution

I don't believe it is possible to instruct Spring to destroy other sessions. However, you can always create a semaphore where your app can check against it whenever the user logs in and invalidate the session if there's already an existing user session running.

This semaphore could be as simple as a Java static variable if you are running in a non-clustered environment, or a better approach is to set the flag in a database table especially if you are running in the clustered environment.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top