src/EventListener/AuthenticationSuccessListener.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\EventListener;
  3. use Lexik\Bundle\JWTAuthenticationBundle\Event\AuthenticationSuccessEvent;
  4. use Symfony\Component\Security\Core\User\UserInterface;
  5. class AuthenticationSuccessListener
  6. {
  7.     /**
  8.      * Triggers when the authentication is successful.
  9.      * @param AuthenticationSuccessEvent $event The event.
  10.      */
  11.     public function onAuthenticationSuccessResponse(AuthenticationSuccessEvent $event)
  12.     {
  13.         $data $event->getData();
  14.         $user $event->getUser();
  15.         if (!$user instanceof UserInterface) {
  16.             return;
  17.         }
  18.         $event->setData($data);
  19.     }
  20. }