src/EventListener/AuthenticationFailureListener.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\EventListener;
  3. use App\Entity\User;
  4. use Lexik\Bundle\JWTAuthenticationBundle\Event\AuthenticationFailureEvent;
  5. /**
  6.  * Authentication Failure Listener.
  7.  *
  8.  * This listener add data to payload.
  9.  */
  10. class AuthenticationFailureListener
  11. {
  12.     /**
  13.      * When this event happened, response can be updated.
  14.      *
  15.      * @param AuthenticationFailureEvent $event the authentication Failure event
  16.      */
  17.     public function onAuthenticationFailureResponse(AuthenticationFailureEvent $event): void
  18.     {
  19.         $response $event->getResponse();
  20.         //TODO : edit your response here
  21.       //  dd($response);
  22.         $event->setResponse($response);
  23.     }
  24. }