Skip to content

[Security] clarified the encoding with memory providers #13188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,18 @@ To fix this, add an ``encoders`` key:
User providers load user information and put it into a :class:`Symfony\\Component\\Security\\Core\\User\\UserInterface`
implementation. If you :doc:`load users from the database </security/entity_provider>`
or :doc:`some other source </security/custom_provider>`, you'll
use your own custom User class. But when you use the "in memory" provider type,
use your own custom User class. But when you use the ``memory`` provider type,
it gives you a :class:`Symfony\\Component\\Security\\Core\\User\\User` object.

Whatever your User class is, you need to tell Symfony what algorithm was
used to encode the passwords. In this case, the passwords are just plaintext,
but in a second, you'll change this to use ``bcrypt``.

.. caution::

When using a ``memory`` provider and the :class:`Symfony\\Component\\Security\\Core\\User\\User`,
you have to choose an encoding without salt (i.e. ``bcrypt``).

If you refresh now, you'll be logged in! The web debug toolbar even tells
you who you are and what roles you have:

Expand Down