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
7e603906
Commit
7e603906
authored
Jun 18, 2012
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed information about the security encoder factory
parent
3732ec18
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
11 deletions
+3
-11
doc/providers/security.rst
doc/providers/security.rst
+3
-11
No files found.
doc/providers/security.rst
View file @
7e603906
...
...
@@ -129,19 +129,11 @@ The default configuration of the extension enforces encoded passwords. To
generate a valid encoded password from a raw password, use the
``security.encoder_factory`` service::
// find the encoder for
the User class (which is the default)
$encoder = $app['security.encoder_factory']->getEncoder(
'Symfony\Component\Security\Core\User\User'
);
// find the encoder for
a UserInterface instance
$encoder = $app['security.encoder_factory']->getEncoder(
$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
``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);
$password = $encoder->encodePassword('foo', $user->getSalt());
When the user is authenticated, the user stored in the token is an instance of
`User
...
...
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