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
58851284
Commit
58851284
authored
Jan 20, 2015
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated docs
parent
f707a6dd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
8 deletions
+24
-8
doc/providers/form.rst
doc/providers/form.rst
+5
-5
doc/providers/security.rst
doc/providers/security.rst
+18
-2
doc/providers/validator.rst
doc/providers/validator.rst
+1
-1
No files found.
doc/providers/form.rst
View file @
58851284
...
...
@@ -19,11 +19,10 @@ Services
<http://api.symfony.com/master/Symfony/Component/Form/FormFactory.html>`_,
that is used for build a form.
* **form.csrf_provider**: An instance of an implementation of
the
* **form.csrf_provider**: An instance of an implementation of
`CsrfProviderInterface
<http://api.symfony.com/master/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderInterface.html>`_,
defaults to a `DefaultCsrfProvider
<http://api.symfony.com/master/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.html>`_.
<http://api.symfony.com/2.3/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderInterface.html>`_ for Symfony 2.3 or
`CsrfTokenManagerInterface <http://api.symfony.com/2.7/Symfony/Component/Security/Csrf/CsrfTokenManagerInterface.html>`_ for Symfony 2.4+.
Registering
-----------
...
...
@@ -61,7 +60,8 @@ Registering
composer require symfony/validator symfony/config symfony/translation
The Symfony Security CSRF component is used to protect forms against CSRF attacks:
The Symfony Security CSRF component is used to protect forms against CSRF
attacks (as of Symfony 2.4+):
.. code-block:: bash
...
...
doc/providers/security.rst
View file @
58851284
...
...
@@ -14,7 +14,12 @@ Services
--------
* **security**: The main entry point for the security provider. Use it to get
the current user token.
the current user token (only for Symfony up to 2.5).
* **security.token_storage**: Gives access to the user token (Symfony 2.6+).
* **security.authorization_checker**: Allows to check authorizations for the
users (Symfony 2.6+).
* **security.authentication_manager**: An instance of
`AuthenticationProviderManager
...
...
@@ -95,6 +100,10 @@ Accessing the current User
The current user information is stored in a token that is accessible via the
``security`` service::
// Symfony 2.6+
$token = $app['security.token_storage']->getToken();
// Symfony 2.3/2.5
$token = $app['security']->getToken();
If there is no information about the user, the token is ``null``. If the user
...
...
@@ -327,6 +336,12 @@ Checking User Roles
To check if a user is granted some role, use the ``isGranted()`` method on the
security context::
// Symfony 2.6+
if ($app['security.authorization_checker']->isGranted('ROLE_ADMIN')) {
// ...
}
// Symfony 2.3/2.5
if ($app['security']->isGranted('ROLE_ADMIN')) {
// ...
}
...
...
@@ -566,7 +581,8 @@ use in your configuration::
// define the authentication listener object
$app['security.authentication_listener.'.$name.'.wsse'] = $app->share(function () use ($app) {
return new WsseListener($app['security'], $app['security.authentication_manager']);
// use 'security' instead of 'security.token_storage' on Symfony <2.6
return new WsseListener($app['security.token_storage'], $app['security.authentication_manager']);
});
return array(
...
...
doc/providers/validator.rst
View file @
58851284
...
...
@@ -14,7 +14,7 @@ Services
--------
* **validator**: An instance of `Validator
<http://api.symfony.com/master/Symfony/Component/Validator/Validator.html>`_.
<http://api.symfony.com/master/Symfony/Component/Validator/Validator
Interface
.html>`_.
* **validator.mapping.class_metadata_factory**: Factory for metadata loaders,
which can read validation constraint information from classes. Defaults to
...
...
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