File tree 1 file changed +6
-7
lines changed
1 file changed +6
-7
lines changed Original file line number<
F286
/th> Diff line number Diff line change @@ -806,11 +806,9 @@ variable.
806
806
Validating a CSRF Token
807
807
-----------------------
808
808
809
- Sometimes you want to use CSRF protection in an action where you don't want to use the
810
- Symfony Form component.
811
-
812
- If, for example, you're doing a DELETE action, you can use the
813
- :method: `Symfony\\ Bundle\\ FrameworkBundle\\ Controller\\ Controller::isCsrfTokenValid `
809
+ Sometimes, you want to use CSRF protection in an action where you don't want to
810
+ use the Symfony Form component. If, for example, you're doing a DELETE action,
811
+ you can use the :method: `Symfony\\ Bundle\\ FrameworkBundle\\ Controller\\ Controller::isCsrfTokenValid `
814
812
method to check the CSRF token::
815
813
816
814
if ($this->isCsrfTokenValid('token_id', $submittedToken)) {
@@ -821,9 +819,10 @@ method to check the CSRF token::
821
819
The ``isCsrfTokenValid() `` shortcut method was introduced in Symfony 2.6.
822
820
It is equivalent to executing the following code::
823
821
824
- use Symfony\C omponent\S ecurity\C srf\C srfToken;
822
+ use Symfony\Component\Security\Csrf\CsrfToken;
825
823
826
- $this->get('security.csrf.token_manager')->isTokenValid(new CsrfToken('token_id', 'TOKEN'));
824
+ $this->get('security.csrf.token_manager')
825
+ ->isTokenValid(new CsrfToken('token_id', 'TOKEN'));
827
826
828
827
Final Thoughts
829
828
--------------
You can’t perform that action at this time.
0 commit comments