summaryrefslogtreecommitdiffstats
path: root/Core/Authentication/Token/AbstractToken.php
diff options
context:
space:
mode:
Diffstat (limited to 'Core/Authentication/Token/AbstractToken.php')
-rw-r--r--Core/Authentication/Token/AbstractToken.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/Core/Authentication/Token/AbstractToken.php b/Core/Authentication/Token/AbstractToken.php
index 210e46d..ee6b207 100644
--- a/Core/Authentication/Token/AbstractToken.php
+++ b/Core/Authentication/Token/AbstractToken.php
@@ -204,4 +204,20 @@ abstract class AbstractToken implements TokenInterface
{
$this->attributes[$name] = $value;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public function __toString()
+ {
+ $class = get_class($this);
+ $class = substr($class, strrpos($class, '\\')+1);
+
+ $roles = array();
+ foreach ($this->roles as $role) {
+ $roles[] = $role->getRole();
+ }
+
+ return sprintf('%s(user="%s", authenticated=%s, roles="%s")', $class, $this->getUsername(), json_encode($this->authenticated), implode(', ', $roles));
+ }
}