I have a design/system requirement to notify a user, User-A
, that there was another active session (by User-B
) prior to User-A
's login. How do you accomplish this using Spring Security?
The scenario is this:
- John Doe logs in to the system using username johndoe
- Jane logs in to the system using johndoe
- The system should display a notification (that includes the other user's IP address) to both users that there was another session created using his or her username .
Example:
After Jane's login in Step-2
, John Doe, upon making a new request (like clicking a link), will receive the ff. notification:
You have been automatically logged-out of the system.
Your login credential was used with IP Address (x.x.x.x).
If you believe your account was compromised, please report...
At the same time, upon Jane's login, she will be notified as well that there was another active session prior to her login.
Your login credential was used with IP Address (x.x.x.x).
If you believe your account was compromised, please report...
I tried looking into custom session management filters, custom concurrent session filters, and custom concurrent control strategy, but I can't wrap my head around the subject. I can't seem to identify w/c item I should customize.
I've also read the Session Management chapter of Spring Security's documentation, but am stuck on how to implement the requirement above.