src\Security\AuthenticationEntryPoint.php line 28
<?phpnamespace App\Security;use Symfony\Component\HttpFoundation\Exception\SessionNotFoundException;use Symfony\Component\HttpFoundation\RedirectResponse;use Symfony\Component\HttpFoundation\Request;use Symfony\Component\HttpFoundation\RequestStack;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\HttpFoundation\Session\SessionInterface;use Symfony\Component\Routing\Generator\UrlGeneratorInterface;use Symfony\Component\Security\Core\Exception\AuthenticationException;use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;class AuthenticationEntryPoint implements AuthenticationEntryPointInterface{private $urlGenerator;private $session;private RequestStack $requestStack;public function __construct(RequestStack $requestStack, UrlGeneratorInterface $urlGenerator){$this->urlGenerator = $urlGenerator;$this->requestStack = $requestStack;$this->session = $this->getSession();if (!$this->session->isStarted()) {$this->session->start();}}// Coonnexion requise pour acceder a une route, redirection icipublic function start(Request $request, AuthenticationException $authException = null): Response{$this->session->getFlashBag()->add('actionPage', 'logFalse');return new RedirectResponse('/');// return new RedirectResponse($this->urlGenerator->generate('home'));}/*** @throws SessionNotFoundException*/private function getSession(): SessionInterface{return $this->requestStack->getSession();}}