Skip to content

Commit b5dd5a1

Browse files
committed
feature #5206 [Cookbook][Security] Replace deprecated csrf_provider service (xelaris)
This PR was submitted for the 2.5 branch but it was merged into the 2.6 branch instead (closes #5206). Discussion ---------- [Cookbook][Security] Replace deprecated csrf_provider service | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 2.5+ | Fixed tickets | The deprecation was introduced in symfony/symfony@d4bb5f4. Commits ------- 6cb591e [Cookbook][Security] Replace deprecated csrf_provider service
2 parents a98f3cd + 6cb591e commit b5dd5a1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

cookbook/security/csrf_in_login_form.rst

+9-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Configuring CSRF Protection
1818

1919
First, configure the Security component so it can use CSRF protection.
2020
The Security component needs a CSRF token provider. You can set this to use the default
21-
provider available in the Form component:
21+
provider available in the Security component:
2222

2323
.. configuration-block::
2424

@@ -31,7 +31,7 @@ provider available in the Form component:
3131
# ...
3232
form_login:
3333
# ...
34-
csrf_provider: form.csrf_provider
34+
csrf_provider: security.csrf.token_manager
3535
3636
.. code-block:: xml
3737
@@ -46,7 +46,7 @@ provider available in the Form component:
4646
<firewall name="secured_area">
4747
<!-- ... -->
4848
49-
<form-login csrf-provider="form.csrf_provider" />
49+
<form-login csrf-provider="security.csrf.token_manager" />
5050
</firewall>
5151
</config>
5252
</srv:container>
@@ -60,12 +60,17 @@ provider available in the Form component:
6060
// ...
6161
'form_login' => array(
6262
// ...
63-
'csrf_provider' => 'form.csrf_provider',
63+
'csrf_provider' => 'security.csrf.token_manager',
6464
)
6565
)
6666
)
6767
));
6868
69+
.. versionadded:: 2.4
70+
The ``security.csrf.token_manager`` service was introduced in Symfony 2.4.
71+
Prior to Symfony 2.4, you can use the ``form.csrf_provider`` service
72+
available in the Form component.
73+
6974
The Security component can be configured further, but this is all information
7075
it needs to be able to use CSRF in the login form.
7176

0 commit comments

Comments
 (0)