src/Module/Firewall/EventSubscriber/LoginRedirectSubscriber.php line 32
<?phpnamespace App\Module\Firewall\EventSubscriber;use Psr\Log\LoggerInterface;use Symfony\Component\EventDispatcher\EventSubscriberInterface;use Symfony\Component\HttpFoundation\RedirectResponse;use Symfony\Component\HttpFoundation\RequestStack;use Symfony\Component\Routing\RouterInterface;use Symfony\Component\Security\Http\Event\LoginSuccessEvent;use Symfony\Component\Security\Http\Util\TargetPathTrait;class LoginRedirectSubscriber implements EventSubscriberInterface{use TargetPathTrait;public function __construct(protected RouterInterface $router,protected LoggerInterface $logger,protected RequestStack $requestStack){}public static function getSubscribedEvents(): array{return [LoginSuccessEvent::class => ['onLoginSuccess', 5]];}public function onLoginSuccess(LoginSuccessEvent $event): void{if ($event->getFirewallName() != 'main'|| $this->requestStack->getCurrentRequest()->headers->has('authorization')){return;}$event->setResponse(new RedirectResponse($this->router->generate('app_module_firewall_firewall_list__invoke')));}}