Httpsessionlistener a single session per user

Asked

Viewed 186 times

0

How can I make only one http session is open per user on the system.

Main technologies in the project:

  1. Spring 4
  2. JSF 2.2
  3. Hibernate 5

Example: The user Juca, works on your computer using 3 browser. (I.e, Firefox and Chrome)

  • If it logs with the 3 at the same time within 1 minute
  • The session is 1 hour
  • Juca left for a meeting
  • I’ll have 3 sessions for Juuca during a 1 without doing anything.
  • Or the 2 wasted (it can work only is a browser, this is system requirement)

  • I am trying to use Httpsessionlistener, to control and invalidate first after the second session.

  • In other words, you must remain the last one logged in.

But I’m not seeing an easy way to do that. (How to recover the previous session itself has no relationship)

Someone has a clearer concept that will solve this?

1 answer

0

I recommend it to you to use spring-security. That part of documentation shows how to use Concurrent Session Control, which is what you need.

  • I posted the issue in stackoverflow in English here and found the solution here

  • Solution in the answer that public class User Implements Httpsessionbindinglistener

Browser other questions tagged

You are not signed in. Login or sign up in order to post.