문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top