Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
77e86f11
Commit
77e86f11
authored
Jun 15, 2017
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed CS
parent
682e1a56
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
doc/providers/csrf.rst
doc/providers/csrf.rst
+7
-7
No files found.
doc/providers/csrf.rst
View file @
77e86f11
...
@@ -15,7 +15,6 @@ Services
...
@@ -15,7 +15,6 @@ Services
* **csrf.token_manager**: An instance of an implementation of the
* **csrf.token_manager**: An instance of an implementation of the
`CsrfTokenManagerInterface
`CsrfTokenManagerInterface
<http://api.symfony.com/master/Symfony/Component/Security/Csrf/CsrfTokenManagerInterface.html>`_,
<http://api.symfony.com/master/Symfony/Component/Security/Csrf/CsrfTokenManagerInterface.html>`_,
Registering
Registering
-----------
-----------
...
@@ -42,12 +41,13 @@ Usage
...
@@ -42,12 +41,13 @@ Usage
When the CSRF Service Provider is registered, all forms created via the Form
When the CSRF Service Provider is registered, all forms created via the Form
Service Provider are protected against CSRF by default.
Service Provider are protected against CSRF by default.
You can also use the CSRF protection even without using the Symfony Form
You can also use the CSRF protection without using the Symfony Form component.
component. If, for example, you're doing a DELETE action, you can create a token::
If, for example, you're doing a DELETE action, create a CSRF token to use in
your code::
use Symfony\Component\Security\Csrf\CsrfToken;
use Symfony\Component\Security\Csrf\CsrfToken;
$csrfToken = $app['csrf.token_manager']->getToken('token_id'); //'TOKEN'
$csrfToken = $app['csrf.token_manager']->getToken('token_id'); //'TOKEN'
then you can check the CSRF token
::
Then check it
::
$app['csrf.token_manager']->isTokenValid(new CsrfToken('token_id', 'TOKEN'));
$app['csrf.token_manager']->isTokenValid(new CsrfToken('token_id', 'TOKEN'));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment