My website is running with Symfony 3.4 and I just install the FOSUserBundle to manage login/authentification. I followed this tutorial but all isn't working perfectly. For the record I can access my homepage view (/app_dev.php/) and my login page view (/app_dev.php/login) but in my security.yml :
In the "main" firewall if "anonymous" is set to "true" : everybody can access all the pages.
In the "main" firewall if "anonymous" is set to "false" :
I don't figure out why this path is making a infinite loop. Below is my security yaml config :
security:
encoders:
FOS\UserBundle\Model\UserInterface: bcrypt
providers:
fos_userbundle:
id: fos_user.user_provider.username
role_hierarchy:
ROLE_ADMIN: ROLE_USER
firewalls:
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
logout: true
anonymous: false
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN }
And in my dev.log, these lines are looped :
[2018-01-15 10:54:24] request.INFO: Matched route "fos_user_security_login". {"route":"fos_user_security_login","route_parameters":{"_controller":"FOS\UserBundle\Controller\SecurityController::loginAction","_route":"fos_user_security_login"},"request_uri":"http://www.mycompany.com/app_dev.php/login","method":"GET"} [] [2018-01-15 10:54:24] security.INFO: An AuthenticationException was thrown; redirecting to authentication entry point. {"exception":"[object] (Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException(code: 0): A Token was not found in the TokenStorage. at /var/www/custom_pim/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AccessListener.php:51)"} [] [2018-01-15 10:54:24] security.DEBUG: Calling Authentication entry point. [] []
