W przeglądarce podaję adres:
localhost:8000/login
i mam informację:
"Pętla przekierowań
Firefox wykrył, że serwer przekierowuje żądanie tego zasobu w sposób uniemożliwiający jego ukończenie.
Problem ten może się pojawić w wyniku zablokowania lub odrzucenia ciasteczek."
natomiast w logach:
[2024-05-30T17:32:19.482675+02:00] security.DEBUG: Calling Authentication entry point. {"entry_point":{"Symfony\\Component\\Security\\Http\\Authenticator\\FormLoginAuthenticator":[]}} []
[2024-05-30T17:32:20.011988+02:00] request.INFO: Matched route "app_login". {"route":"app_login","route_parameters":{"_route":"app_login","_controller":"App\\Controller\\LoginController::index"},"request_uri":"http://localhost:8000/login","method":"GET"} []
[2024-05-30T17:32:20.037459+02:00] security.DEBUG: Checking for authenticator support. {"firewall_name":"main","authenticators":1} []
[2024-05-30T17:32:20.037574+02:00] security.DEBUG: Checking support on authenticator. {"firewall_name":"main","authenticator":"Symfony\\Component\\Security\\Http\\Authenticator\\FormLoginAuthenticator"} []
[2024-05-30T17:32:20.037647+02:00] security.DEBUG: Authenticator does not support the request. {"firewall_name":"main","authenticator":"Symfony\\Component\\Security\\Http\\Authenticator\\FormLoginAuthenticator"} []
[2024-05-30T17:32:20.046241+02:00] security.DEBUG: Access denied, the user is not fully authenticated; redirecting to authentication entry point. {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException(code: 403): Access Denied. at C:\\xampp\\htdocs\\ligatyperow3\\vendor\\symfony\\security-http\\Firewall\\AccessListener.php:87)"} []
w konfiguracji mam tak :
services.yaml:
form_login:
default_target_path: liga_typerow_table
always_use_default_target_path: true
logout:
path: /logout
target: /login
access_control:
- { path: ^/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY}
- { path: ^/, roles: ROLE_USER}
- { path: ^/admin-panel, roles: ROLE_SUPER_ADMIN }
kod:
LoginController.php :
<?php namespace App\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; class LoginController extends AbstractController { #[Route('/login', name: 'app_login')] public function index(): Response { return $this->render('login/index.html.twig', [ 'controller_name' => 'LoginController', ]); } }