8000 [Ldap] Make LdapUser implement EquatableInterface by chalasr · Pull Request #33239 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Ldap] Make LdapUser implement EquatableInterface #33239

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
Aug 19, 2019
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
27 changes: 26 additions & 1 deletion src/Symfony/Component/Ldap/Security/LdapUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
namespace Symfony\Component\Ldap\Security;

use Symfony\Component\Ldap\Entry;
use Symfony\Component\Security\Core\User\EquatableInterface;
use Symfony\Component\Security\Core\User\UserInterface;

/**
* @author Robin Chalas <robin.chalas@gmail.com>
*
* @final
*/
class LdapUser implements UserInterface
class LdapUser implements UserInterface, EquatableInterface
{
private $entry;
private $username;
Expand Down Expand Up @@ -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;
}
}
0