src/EventListener/JwtAuthenticationSuccessListener.php line 10

  1. <?php
  2. namespace App\EventListener;
  3. use App\Entity\User;
  4. use Lexik\Bundle\JWTAuthenticationBundle\Event\AuthenticationSuccessEvent;
  5. class JwtAuthenticationSuccessListener
  6. {
  7.     public function onAuthenticationSuccessResponse(AuthenticationSuccessEvent $event): void
  8.     {
  9.         $data $event->getData();
  10.         $user $event->getUser();
  11.         if (!$user instanceof User) {
  12.             return;
  13.         }
  14.         $data['uuid'] = $user->getUuid();
  15.         $event->setData($data);
  16.     }
  17. }