summaryrefslogtreecommitdiffstats
path: root/Core/User/ComparableInterface.php
diff options
context:
space:
mode:
authorDariusz Górecki <darek.krk@gmail.com>2011-12-19 20:19:35 +0100
committerDariusz Górecki <darek.krk@gmail.com>2012-01-10 21:54:56 +0100
commit139482e0da4b00a4cbb33c6ccdd5a922c1ffdd88 (patch)
tree397f799e434eb990d76c74c6db64846e4529be56 /Core/User/ComparableInterface.php
parent4c21da78b969090d04c5c9c772902a1bfe6cedd5 (diff)
downloadsymfony-security-139482e0da4b00a4cbb33c6ccdd5a922c1ffdd88.zip
symfony-security-139482e0da4b00a4cbb33c6ccdd5a922c1ffdd88.tar.gz
symfony-security-139482e0da4b00a4cbb33c6ccdd5a922c1ffdd88.tar.bz2
[BC Break][Security] Moved user comparsion logic out of UserInterface As discussed on IRC meetings and in PR #2669 I came up with implementation. This is option2, I think more elegant.
BC break: yes Feature addition: no/feature move Symfony2 test pass: yes Symfony2 test written: yes Todo: feedback needed
Diffstat (limited to 'Core/User/ComparableInterface.php')
-rw-r--r--Core/User/ComparableInterface.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/Core/User/ComparableInterface.php b/Core/User/ComparableInterface.php
new file mode 100644
index 0000000..2d1fe8f
--- /dev/null
+++ b/Core/User/ComparableInterface.php
@@ -0,0 +1,32 @@
+<?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;
+
+/**
+ * ComparatorInterface used to test if two object are equal in security
+ * and re-authentication context.
+ *
+ * @author Dariusz Górecki <darek.krk@gmail.com>
+ */
+interface ComparableInterface
+{
+ /**
+ * 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.
+ *
+ * @return boolean
+ */
+ public function compareTo($object);
+}