src/Authentication/EventListener/JWTNotFoundListener.php line 10

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace App\Authentication\EventListener;
  3. use Lexik\Bundle\JWTAuthenticationBundle\Event\JWTNotFoundEvent;
  4. use Symfony\Component\HttpFoundation\JsonResponse;
  5. class JWTNotFoundListener
  6. {
  7.     public function onJWTNotFound(JWTNotFoundEvent $event): void
  8.     {
  9.         $data = [
  10.             'code' => 'error.authentication.required',
  11.         ];
  12.         $response = new JsonResponse($data401);
  13.         $event->setResponse($response);
  14.     }
  15. }