summaryrefslogtreecommitdiffstats
path: root/Core/User
diff options
context:
space:
mode:
Diffstat (limited to 'Core/User')
-rw-r--r--Core/User/ChainUserProvider.php6
-rw-r--r--Core/User/EquatableInterface.php37
-rw-r--r--Core/User/User.php40
-rw-r--r--Core/User/UserInterface.php15
4 files changed, 40 insertions, 58 deletions
diff --git a/Core/User/ChainUserProvider.php b/Core/User/ChainUserProvider.php
index 14a0dec..376ba1c 100644
--- a/Core/User/ChainUserProvider.php
+++ b/Core/User/ChainUserProvider.php
@@ -1,12 +1,12 @@
<?php
/*
- * This file is part of the Symfony framework.
+ * This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
- * This source file is subject to the MIT license that is bundled
- * with this source code in the file LICENSE.
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\User;
diff --git a/Core/User/EquatableInterface.php b/Core/User/EquatableInterface.php
new file mode 100644
index 0000000..e2bde9e
--- /dev/null
+++ b/Core/User/EquatableInterface.php
@@ -0,0 +1,37 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Security\Core\User;
+
+/**
+ * EquatableInterface used to test if two objects are equal in security
+ * and re-authentication context.
+ *
+ * @author Dariusz Górecki <darek.krk@gmail.com>
+ */
+interface EquatableInterface
+{
+ /**
+ * The equality comparison should neither be done by referential equality
+ * nor by comparing identities (i.e. getId() === getId()).
+ *
+ * However, you do not need to compare every attribute, but only those that
+ * are relevant for assessing whether re-authentication is required.
+ *
+ * Also implementation should consider that $user instance may implement
+ * the extended user interface `AdvancedUserInterface`.
+ *
+ * @param UserInterface $user
+ *
+ * @return Boolean
+ */
+ function isEqualTo(UserInterface $user);
+}
diff --git a/Core/User/User.php b/Core/User/User.php
index d586511..6076603 100644
--- a/Core/User/User.php
+++ b/Core/User/User.php
@@ -112,44 +112,4 @@ final class User implements AdvancedUserInterface
public function eraseCredentials()
{
}
-
- /**
- * {@inheritDoc}
- */
- public function equals(UserInterface $user)
- {
- if (!$user instanceof User) {
- return false;
- }
-
- if ($this->password !== $user->getPassword()) {
- return false;
- }
-
- if ($this->getSalt() !== $user->getSalt()) {
- return false;
- }
-
- if ($this->username !== $user->getUsername()) {
- return false;
- }
-
- if ($this->accountNonExpired !== $user->isAccountNonExpired()) {
- return false;
- }
-
- if ($this->accountNonLocked !== $user->isAccountNonLocked()) {
- return false;
- }
-
- if ($this->credentialsNonExpired !== $user->isCredentialsNonExpired()) {
- return false;
- }
-
- if ($this->enabled !== $user->isEnabled()) {
- return false;
- }
-
- return true;
- }
}
diff --git a/Core/User/UserInterface.php b/Core/User/UserInterface.php
index 85356b7..ce3b3a8 100644
--- a/Core/User/UserInterface.php
+++ b/Core/User/UserInterface.php
@@ -84,19 +84,4 @@ interface UserInterface
* @return void
*/
function eraseCredentials();
-
- /**
- * Returns whether or not the given user is equivalent to *this* user.
- *
- * The equality comparison should neither be done by referential equality
- * nor by comparing identities (i.e. getId() === getId()).
- *
- * However, you do not need to compare every attribute, but only those that
- * are relevant for assessing whether re-authentication is required.
- *
- * @param UserInterface $user
- *
- * @return Boolean
- */
- function equals(UserInterface $user);
}