src/User/EventSubscriber/RefreshEventsSubscriber.php line 29

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Redatum\User\EventSubscriber;
  4. use Gesdinet\JWTRefreshTokenBundle\Event\RefreshAuthenticationFailureEvent;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. use VisualCraft\RestBaseBundle\Problem\ProblemResponseFactory;
  7. class RefreshEventsSubscriber implements EventSubscriberInterface
  8. {
  9.     private ProblemResponseFactory $problemResponseFactory;
  10.     public function __construct(ProblemResponseFactory $problemResponseFactory)
  11.     {
  12.         $this->problemResponseFactory $problemResponseFactory;
  13.     }
  14.     public static function getSubscribedEvents(): array
  15.     {
  16.         return [
  17.             'gesdinet.refresh_token_failure' => [
  18.                 ['processRefreshFailure'],
  19.             ],
  20.         ];
  21.     }
  22.     public function processRefreshFailure(RefreshAuthenticationFailureEvent $event): void
  23.     {
  24.         $exception $event->getException();
  25.         $event->setResponse($this->problemResponseFactory->create($exception));
  26.     }
  27. }