lib/boab/cms-bundle/src/Api/EventListener/JWTErrorListener.php line 12

Open in your IDE?
  1. <?php
  2. namespace Boab\CmsBundle\Api\EventListener;
  3. use Lexik\Bundle\JWTAuthenticationBundle\Event\JWTNotFoundEvent;
  4. use Symfony\Component\HttpFoundation\JsonResponse;
  5. class JWTErrorListener
  6. {
  7.     /**
  8.      * @param JWTNotFoundEvent $event
  9.      */
  10.     public function onJWTNotFound(JWTNotFoundEvent $event)
  11.     {
  12.         $data = [
  13.             'code'=>403,
  14.             'status'  => '403 Forbidden',
  15.             'message' => 'Missing token',
  16.         ];
  17.         $response = new JsonResponse($data403);
  18.         $event->setResponse($response);
  19.     }    
  20. }