- md5
- 43e9207e00f1abd9c97c59ad804c252a
- sha1
- 714a5979db2d4aa488ec16fc91fe1d157a678ef0
- sha256
- d6359887ddf2fd2b49c273515bfd5ae03340977aaacd16ae71134f2c79100ff0
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Ldap\Security;
use Symfony\Component\Ldap\Entry;
use Symfony\Component\Security\Core\User\EquatableInterface;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @author Robin Chalas <[email protected]>
*
* @final
*/
class LdapUser implements UserInterface, PasswordAuthenticatedUserInterface, EquatableInterface
{
private $entry;
private $username;
private $password;
private $roles;
private $extraFields;
public function __construct(Entry $entry, string $username, ?string $password, array $roles = [], array $extraFields = [])
{
if (!$username) {
throw new \InvalidArgumentException('The username cannot be empty.');
}
$this->entry = $entry;
$this->username = $username;
$this->password = $password;
$this->roles = $roles;
$this->extraFields = $extraFields;
}
public function getEntry(): Entry
{
return $this->entry;
}
/**
* {@inheritdoc}
*/
public function getRoles(): array
{
return $this->roles;
}
/**
* {@inheritdoc}
*/
public function getPassword(): ?string
{
return $this->password;
}
/**
* {@inheritdoc}
*/
public function getSalt(): ?string
{
return null;
}
/**
* {@inheritdoc}
*/
public function getUsername(): string
{
trigger_deprecation('symfony/ldap', '5.3', 'Method "%s()" is deprecated and will be removed in 6.0, use getUserIdentifier() instead.', __METHOD__);
return $this->username;
}
public function getUserIdentifier(): string
{
return $this->username;
}
/**
* {@inheritdoc}
*/
public function eraseCredentials()
{
$this->password = null;
}
public function getExtraFields(): array
{
return $this->extraFields;
}
public function setPassword(string $password)
{
$this->password = $password;
}
/**
* {@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->getUserIdentifier() !== $user->getUserIdentifier()) {
return false;
}
return true;
}
}
The same content is in 119 releases, Joomla 4.0.0-rc6 to 4.4.14. See them all, or every version of this file.