Skip to content

[Security] rename User to InMemoryUser #15157

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
Apr 16, 2021
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions components/security/authentication.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,14 @@ receives an array of encoders::
use Acme\Entity\LegacyUser;
use Symfony\Component\Security\Core\Encoder\EncoderFactory;
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
use Symfony\Component\Security\Core\User\User;
use Symfony\Component\Security\Core\User\InMemoryUser;

$defaultEncoder = new MessageDigestPasswordEncoder('sha512', true, 5000);
$weakEncoder = new MessageDigestPasswordEncoder('md5', true, 1);

$encoders = [
User::class => $defaultEncoder,
LegacyUser::class => $weakEncoder,
InMemoryUser::class => $defaultEncoder,
LegacyUser::class => $weakEncoder,
// ...
];
$encoderFactory = new EncoderFactory($encoders);
Expand Down
10 changes: 5 additions & 5 deletions security/user_provider.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ interface only requires one method: ``loadUserByUsername($username)``::
public function loadUserByUsername(string $usernameOrEmail)
{
$entityManager = $this->getEntityManager();

return $entityManager->createQuery(
'SELECT u
FROM App\Entity\User u
Expand Down Expand Up @@ -231,7 +231,7 @@ users will encode their passwords:
# ...
encoders:
# this internal class is used by Symfony to represent in-memory users
Symfony\Component\Security\Core\User\User: 'auto'
Symfony\Component\Security\Core\User\InMemoryUser: 'auto'

.. code-block:: xml

Expand All @@ -249,7 +249,7 @@ users will encode their passwords:
<!-- ... -->

<!-- this internal class is used by Symfony to represent in-memory users -->
<encoder class="Symfony\Component\Security\Core\User\User"
<encoder class="Symfony\Component\Security\Core\User\InMemoryUser"
algorithm="auto"
/>
</config>
Expand All @@ -260,7 +260,7 @@ users will encode their passwords:
// config/packages/security.php

// this internal class is used by Symfony to represent in-memory users
use Symfony\Component\Security\Core\User\User;
use Symfony\Component\Security\Core\User\InMemoryUser;

$container->loadFromExtension('security', [
// ...
Expand Down Expand Up @@ -417,7 +417,7 @@ command will generate a nice skeleton to get you started::
{
return User::class === $class || is_subclass_of($class, User::class);
}

/**
* Upgrades the encoded password of a user, typically for using a better hash algorithm.
*/
Expand Down