From 9ae3f828f6c07278e190b3a01f3516589ab1a6b2 Mon Sep 17 00:00:00 2001 From: jonasarts Date: Fri, 29 Dec 2017 11:46:12 +0100 Subject: [PATCH 1/2] Added tip to enable CsrfTokenManager as service in the framework configuration file as it is required for autowiring on the ExampleFormAuthenticator constructor --- security/guard_authentication.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/security/guard_authentication.rst b/security/guard_authentication.rst index 8af6551646a..6032cb922a0 100644 --- a/security/guard_authentication.rst +++ b/security/guard_authentication.rst @@ -519,6 +519,11 @@ service to be passed) and add the following logic:: // ... } + +.. tip:: + +   Don't forget to enable `csrf_protection` in the `config/framework.yml` file that + CsrfTokenManagerInterface can get autowired. Frequently Asked Questions -------------------------- From 21d42f3136d410d7bbbc44dff1f178dda28569a7 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 4 Jan 2018 11:51:37 +0100 Subject: [PATCH 2/2] Reword --- security/guard_authentication.rst | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/security/guard_authentication.rst b/security/guard_authentication.rst index 6032cb922a0..3886b80b5e2 100644 --- a/security/guard_authentication.rst +++ b/security/guard_authentication.rst @@ -484,7 +484,8 @@ Adding CSRF Protection If you're using a Guard authenticator to build a login form and want to add CSRF protection, no problem! -First, :ref:`add the _csrf_token to your login template `. +First, check that :ref:`the csrf_protection option ` +is enabled and :ref:`add the _csrf_token field to your login form `. Then, type-hint ``CsrfTokenManagerInterface`` in your ``__construct()`` method (or manually configure the ``Symfony\Component\Security\Csrf\CsrfTokenManagerInterface`` @@ -519,11 +520,6 @@ service to be passed) and add the following logic:: // ... } - -.. tip:: - -   Don't forget to enable `csrf_protection` in the `config/framework.yml` file that - CsrfTokenManagerInterface can get autowired. Frequently Asked Questions --------------------------