|
@@ -75,6 +75,15 @@ abstract class AbstractToken implements TokenInterface
|
|
return $this->user;
|
|
return $this->user;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Sets the user in 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)
|
|
public function setUser($user)
|
|
{
|
|
{
|
|
if (!($user instanceof UserInterface || (is_object($user) && method_exists($user, '__toString')) || is_string($user))) {
|
|
if (!($user instanceof UserInterface || (is_object($user) && method_exists($user, '__toString')) || is_string($user))) {
|