Commit 496aa805 authored by Fabien Potencier's avatar Fabien Potencier

fixed documentation (closes #375)

parent 315c9626
...@@ -127,14 +127,22 @@ Each user is defined with the following information: ...@@ -127,14 +127,22 @@ Each user is defined with the following information:
The default configuration of the extension enforces encoded passwords. To The default configuration of the extension enforces encoded passwords. To
generate a valid encoded password from a raw password, use the generate a valid encoded password from a raw password, use the
``security.encoder`` service:: ``security.encoder_factory`` service::
// find the encoded password for foo // find the encoder for the User class (which is the default)
$password = $app['security.encoder']->encodePassword('foo', null); $encoder = $app['security.encoder_factory']->getEncoder('Symfony\Component\Security\Core\User\User');
// compute the encoded password for foo
$password = $encoder->encodePassword('foo', null);
The second argument is the salt to be used for the user (defaults to The second argument is the salt to be used for the user (defaults to
``null``). ``null``).
You can also get the encoder directly by its name. By default, use the
``security.encoder.digest`` service::
$password = $app['security.encoder.digest']->encodePassword('foo', null);
When the user is authenticated, the user stored in the token is an instance of When the user is authenticated, the user stored in the token is an instance of
`User `User
<http://api.symfony.com/master/Symfony/Component/Security/Core/User/User.html>`_ <http://api.symfony.com/master/Symfony/Component/Security/Core/User/User.html>`_
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment