diff --git a/src/Symfony/Component/Ldap/Security/LdapUser.php b/src/Symfony/Component/Ldap/Security/LdapUser.php index 42c6dbcdf889..ce20f2fd5233 100644 --- a/src/Symfony/Component/Ldap/Security/LdapUser.php +++ b/src/Symfony/Component/Ldap/Security/LdapUser.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Ldap\Security; use Symfony\Component\Ldap\Entry; +use Symfony\Component\Security\Core\User\EquatableInterface; use Symfony\Component\Security\Core\User\UserInterface; /** @@ -19,7 +20,7 @@ * * @final */ -class LdapUser implements UserInterface +class LdapUser implements UserInterface, EquatableInterface { private $entry; private $username; @@ -88,4 +89,28 @@ public function getExtraFields(): array { return $this->extraFields; } + + /** + * {@inheritdoc} + */ + public function isEqualTo(UserInterface $user): bool + { + if (!$user instanceof self) { + return false; + } + + if ($this->getPassword() !== $user->getPassword()) { + return false; + } + + if ($this->getSalt() !== $user->getSalt()) { + return false; + } + + if ($this->getUsername() !== $user->getUsername()) { + return false; + } + + return true; + } }