Closed
Description
Symfony version(s) affected
5.4.1
Description
Can't authenticate with FormLoginAuthenticator
.
How to reproduce
# security.yaml
firewalls:
app:
...
form_login:
enable_csrf: true
Symfony app is serving by a nginx running on docker,
if i try to login using a hostname :
=> foo.local:8001/login
Got error :
[2021-12-09T18:23:05.087720+01:00] security.INFO: Authenticator failed. {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\InvalidCsrfTokenException(code: 0): Invalid CSRF token. at /home/docker/symfony/vendor/symfony/security-http/EventListener/CsrfProtectionListener.php:51)","authenticator":"Symfony\\Component\\Security\\Http\\Authenticator\\Debug\\TraceableAuthenticator"} []
[2021-12-09T18:23:05.087796+01:00] security.DEBUG: Authentication failure, redirect triggered. {"failure_path":"umbrella_admin_login"} []
[2021-12-09T18:23:05.119546+01:00] security.DEBUG: The "Symfony\Component\Security\Http\Authenticator\Debug\TraceableAuthenticator" authenticator set the failure response. {"authenticator":"Symfony\\Component\\Security\\Http\\Authenticator\\Debug\\TraceableAuthenticator"} []
[2021-12-09T18:23:05.119629+01:00] security.DEBUG: The "Symfony\Component\Security\Http\Authenticator\Debug\TraceableAuthenticator" authenticator set the response. Any later authenticator will not be called {"authenticator":"Symfony\\Component\\Security\\Http\\Authenticator\\Debug\\TraceableAuthenticator"} []
[2021-12-09T18:23:05.145225+01:00] request.INFO: Matched route "umbrella_admin_login". {"route":"umbrella_admin_login","route_parameters":{"_route":"umbrella_admin_login","_controller":"Umbrella\\AdminBundle\\Controller\\SecurityController::login"},"request_uri":"http://foo.local:8001/login","method":"GET"} []
[2021-12-09T18:23:05.146043+01:00] security.DEBUG: Checking for authenticator support. {"firewall_name":"app","authenticators":1} []
[2021-12-09T18:23:05.146079+01:00] security.DEBUG: Checking support on authenticator. {"firewall_name":"app","authenticator":"Symfony\\Component\\Security\\Http\\Authenticator\\FormLoginAuthenticator"} []
[2021-12-09T18:23:05.146106+01:00] security.DEBUG: Authenticator does not support the request. {"firewall_name":"app","authenticator":"Symfony\\Component\\Security\\Http\\Authenticator\\FormLoginAuthenticator"} []
if i try to login using a hostname :
=> foo.local:8001/login : it works
Downgrade symfony to 5.4.0 solve the problem.
Possible Solution
No response
Additional Context
No response