src/EventListener/JWTExpiredListener.php line 20

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: rostandnj
  5.  * Date: 19/3/19
  6.  * Time: 11:24 AM
  7.  */
  8. namespace App\EventListener;
  9. use Lexik\Bundle\JWTAuthenticationBundle\Event\JWTExpiredEvent;
  10. use Lexik\Bundle\JWTAuthenticationBundle\Response\JWTAuthenticationFailureResponse;
  11. //use Lexik\Bundle\JWTAuthenticationBundle\Event\JWTFailureEventInterface;
  12. class JWTExpiredListener
  13. {
  14.     /**
  15.      * @param JWTExpiredEvent $event
  16.      */
  17.     public function onJWTExpired(JWTExpiredEvent $event)
  18.     {
  19.         /** @var JWTAuthenticationFailureResponse */
  20.         $response $event->getResponse();
  21.         $response->setMessage(["message"=>'Your token is expired, please renew it.',"code"=>"expired_token","status"=>"403 forbidden"]);
  22.     }
  23. }