summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Core/Authentication/Token/AbstractToken.php9
-rw-r--r--Core/Authentication/Token/UsernamePasswordToken.php2
2 files changed, 10 insertions, 1 deletions
diff --git a/Core/Authentication/Token/AbstractToken.php b/Core/Authentication/Token/AbstractToken.php
index dc21684..2cb355a 100644
--- a/Core/Authentication/Token/AbstractToken.php
+++ b/Core/Authentication/Token/AbstractToken.php
@@ -75,6 +75,15 @@ abstract class AbstractToken implements TokenInterface
return $this->user;
}
+ /**
+ * Sets the user into the token.
+ *
+ * The user can be a UserInterface instance, or an object implementing
+ * a __toString method or the username as a regular string.
+ *
+ * @param mixed $user The user
+ * @throws \InvalidArgumentException
+ */
public function setUser($user)
{
if (!($user instanceof UserInterface || (is_object($user) && method_exists($user, '__toString')) || is_string($user))) {
diff --git a/Core/Authentication/Token/UsernamePasswordToken.php b/Core/Authentication/Token/UsernamePasswordToken.php
index 6c6ed5b..95eec54 100644
--- a/Core/Authentication/Token/UsernamePasswordToken.php
+++ b/Core/Authentication/Token/UsernamePasswordToken.php
@@ -24,7 +24,7 @@ class UsernamePasswordToken extends AbstractToken
/**
* Constructor.
*
- * @param string $user The username (like a nickname, email address, etc.)
+ * @param string $user The username (like a nickname, email address, etc.), or a UserInterface instance or an object implementing a __toString method.
* @param string $credentials This usually is the password of the user
* @param string $providerKey The provider key
* @param array $roles An array of roles