1
votes

Symfony 3.0.7

I trying to disable csrf protection globally:

framework:
    csrf_protection: false

And then I have exception:

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The service "security.firewall.map.context.main" has a dependency on a non-existent service "security.csrf.token_manager".

But service "security.csrf.token_manager" exists if I trying use it directly in code.

Full error backtrace:

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The service "security.firewall.map.context.main" has a dependency on a non-existent service "security.csrf.token_manager".

/var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:58 /var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:42 /var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:53 /var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:51 /var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:42 /var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php:36 /var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:104 /var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:545 /var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:477 /var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:117 /var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php:146 /var/www/studio.lc/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php:33 /var/www/studio.lc/src/Studio/Bundle/AdminBundle/Tests/Controller/SecuredAreaControllerWebTestCase.php:21

How can I fix it?

1
did you solved it? im having the same problemPipe

1 Answers

1
votes

This is the following syntax in the config.yml :

 csrf_protection: 
     enabled: false

And if you just go to your security.yml file and remove the csrf_provider or csrf_token_generator from the form_login directive.