title: How to notify user of another session using Spring Security?
body: <p>I have a design/system requirement to notify a user, <code>User-A</code>, that there was another active session (by <code>User-B</code>) prior to <code>User-A</code>'s login. How do you accomplish this using Spring Security?</p>
  
  <p>The scenario is this:</p>
  
  <ol>
  <li><strong>John Doe</strong> logs in to the system using username <strong>johndoe</strong></li>
  <li><strong>Jane</strong> logs in to the system using <strong>johndoe</strong></li>
  <li>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 .</li>
  </ol>
  
  <p>Example:</p>
  
  <p>After <strong>Jane's</strong> login in <code>Step-2</code>, <strong>John Doe</strong>, upon making a new request (like clicking a link), will receive the ff. notification:</p>
  
  <pre><code>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...
  </code></pre>
  
  <p>At the same time, upon <strong>Jane</strong>'s login, she will be notified as well that there was another active session prior to her login.</p>
  
  <pre><code>Your login credential was used with IP Address (x.x.x.x).
  If you believe your account was compromised, please report...
  </code></pre>
  
  <p>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. </p>
  
  <p>I've also read the <a href="http://static.springsource.org/spring-security/site/docs/3.1.x/reference/session-mgmt.html" rel="nofollow">Session Management</a> chapter of Spring Security's documentation, but am stuck on how to implement the requirement above.</p>