Skip to content

Commit

Permalink
[#5572] Fix syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj committed Jul 29, 2015
1 parent 85dc294 commit f67c353
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions book/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -806,11 +806,9 @@ variable.
Validating a CSRF Token
-----------------------

Sometimes you want to use CSRF protection in an action where you don't want to use the
Symfony Form component.

If, for example, you're doing a DELETE action, you can use the
:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::isCsrfTokenValid`
Sometimes, you want to use CSRF protection in an action where you don't want to
use the Symfony Form component. If, for example, you're doing a DELETE action,
you can use the :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::isCsrfTokenValid`
method to check the CSRF token::

if ($this->isCsrfTokenValid('token_id', $submittedToken)) {
Expand All @@ -821,9 +819,10 @@ method to check the CSRF token::
The ``isCsrfTokenValid()`` shortcut method was introduced in Symfony 2.6.
It is equivalent to executing the following code::

use Symfony\Component\Security\Csrf\CsrfToken;
use Symfony\Component\Security\Csrf\CsrfToken;

$this->get('security.csrf.token_manager')->isTokenValid(new CsrfToken('token_id', 'TOKEN'));
$this->get('security.csrf.token_manager')
->isTokenValid(new CsrfToken('token_id', 'TOKEN'));

Final Thoughts
--------------
Expand Down

0 comments on commit f67c353

Please sign in to comment.