title: How to avoid multiple user sessions in symfony 4?
body: <p>How can I prevent a register user from accessing the site from multiple devices?</p>
  
  <p>I create a function onSecurityInteractiveLogin in a EventListener</p>
  
  <pre><code>&lt;?php
  
  
  namespace App\EventListener;
  
  use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
  
  class LoginListener
  {
  
      public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
      {
          $user = $event-&gt;getAuthenticationToken()-&gt;getUser();
          $session = $event-&gt;getRequest()-&gt;getSession();
          //TODO validate if that user is logged in
      }
  
  
  }
  </code></pre>
  
  <p>But I can't get if the user is logged in other device and close that session, I found a solution but in Symfony 2.3 in <a href="https://stackoverflow.com/questions/10615363/allow-only-one-connection-on-the-same-login-with-fosuserbundle">here</a>.</p>
  
  <p>Can anybody explain me a solution in Symfony 4?</p>