8000 Merge branches by xabbuh · Pull Request #5816 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Merge branches #5816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 5, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[#5572] Fix syntax
  • Loading branch information
wouterj committed Jul 29, 2015
commit f67c353b576d5b1e65d72b36db939b85f1833913
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