Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d792c49

Browse filesBrowse files
committed
[cookbook][security] Adding details on how the passwords are encoded multiple times and converted to base64 - per tip from @stof
1 parent 91c6267 commit d792c49
Copy full SHA for d792c49

File tree

Expand file treeCollapse file tree

1 file changed

+18
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+18
-2
lines changed

‎cookbook/security/custom_provider.rst

Copy file name to clipboardExpand all lines: cookbook/security/custom_provider.rst
+18-2Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ The value here should correspond with however the passwords were originally
230230
encoded when creating your users (however those users were created). When
231231
a user submits her password, the password is appended to the salt value and
232232
then encoded using this algorithm before being compared to the hashed password
233-
returned by your ``getPassword()`` method.
233+
returned by your ``getPassword()`` method. Additionally, depending on your
234+
options, the password may be encoded multiple times and encoded to base64.
234235

235236
.. sidebar:: Specifics on how passwords are encoded
236237

@@ -246,4 +247,19 @@ returned by your ``getPassword()`` method.
246247
then you'll need to do a bit more work so that Symfony properly encodes
247248
the password. That is beyond the scope of this entry, but would include
248249
sub-classing ``MessageDigestPasswordEncoder`` and overriding the ``mergePasswordAndSalt``
249-
method.
250+
method.
251+
252+
Additionally, the hash, by default, is encoded multiple times and encoded
253+
to base64. For specific details, see `MessageDigestPasswordEncoder`_.
254+
To prevent this, configure it in ``security.yml``:
255+
256+
.. code-block:: yaml
257+
258+
security:
259+
encoders:
260+
Acme\WebserviceUserBundle\Security\User\WebserviceUser:
261+
algorithm: sha512
262+
encode_as_base64: false
263+
iterations: 1
264+
265+
.. _MessageDigestPasswordEncoder: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Security/Core/Encoder/MessageDigestPasswordEncoder.php

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.