title: Symfony4 SwitchUserSubscriber doesn't distinguish between two users
body: <p>in my S4 application i need the switch user "functionality" for super user. I have a form input with autocomplete to search users (available only for ROLE_SUPERADMIN) but i would like to forbid to a user to impersonate itself.  I've implemented this eventsubscriber but for both , $currentUser and $targetUser, it return the same identity (the target one). Where am i wrong?</p>
  
  <pre><code>&lt;?php
  
  namespace App\EventSubscriber;
  
  use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
  use Symfony\Component\Security\Http\Event\SwitchUserEvent;
  
  class SwitchUserSubscriber implements EventSubscriberInterface
  {
      public function onSecuritySwitchUser(SwitchUserEvent $event)
      {
          $currentUser = $event-&gt;getToken()-&gt;getUser();
          $targetUser = $event-&gt;getTargetUser();
  
          if($currentUser-&gt;getUsername() == $targetUser-&gt;getUsername()){
              throw new UnsupportedUserException("You can't impersonate yourself");
          }
      }
  
      public static function getSubscribedEvents()
      {
          return [
             'security.switch_user' =&gt; 'onSecuritySwitchUser',
          ];
      }
  }
  </code></pre>
  
  <p>Is there a better way to achieve this?</p>