summaryrefslogtreecommitdiffstats
path: root/Authentication/Token
diff options
context:
space:
mode:
authorJohannes Schmitt <schmittjoh@gmail.com>2010-12-12 09:41:47 +0100
committerFabien Potencier <fabien.potencier@gmail.com>2010-12-12 10:49:43 +0100
commitb8fc4a14f4cff6bb490cf04422716a2949b6f3bc (patch)
tree5b4ce483f41293c29fab9a7110c57e72ba216188 /Authentication/Token
parentfed3bb4daa2f8205dc0a873d16eddccc3e44bb8a (diff)
downloadsymfony-security-b8fc4a14f4cff6bb490cf04422716a2949b6f3bc.zip
symfony-security-b8fc4a14f4cff6bb490cf04422716a2949b6f3bc.tar.gz
symfony-security-b8fc4a14f4cff6bb490cf04422716a2949b6f3bc.tar.bz2
added authentication trust resolver
Diffstat (limited to 'Authentication/Token')
-rw-r--r--Authentication/Token/RememberMeToken.php56
1 files changed, 56 insertions, 0 deletions
diff --git a/Authentication/Token/RememberMeToken.php b/Authentication/Token/RememberMeToken.php
new file mode 100644
index 0000000..587222d
--- /dev/null
+++ b/Authentication/Token/RememberMeToken.php
@@ -0,0 +1,56 @@
+<?php
+
+namespace Symfony\Component\Security\Authentication\Token;
+
+use Symfony\Component\Security\Authentication\RememberMe\PersistentTokenInterface;
+use Symfony\Component\Security\User\AccountInterface;
+
+/**
+ * Base class for "Remember Me" tokens
+ *
+ * @author Johannes M. Schmitt <schmittjoh@gmail.com>
+ */
+class RememberMeToken extends Token
+{
+ protected $key;
+
+ /**
+ * The persistent token which resulted in this authentication token.
+ *
+ * @var PersistentTokenInterface
+ */
+ protected $persistentToken;
+
+ /**
+ * Constructor.
+ *
+ * @param string $username
+ * @param string $key
+ */
+ public function __construct(AccountInterface $user, $key) {
+ parent::__construct($user->getRoles());
+
+ if (0 === strlen($key)) {
+ throw new \InvalidArgumentException('$key cannot be empty.');
+ }
+
+ $this->user = $user;
+ $this->key = $key;
+ $this->setAuthenticated(true);
+ }
+
+ public function getKey()
+ {
+ return $this->key;
+ }
+
+ public function setPersistentToken(PersistentTokenInterface $persistentToken)
+ {
+ $this->persistentToken = $persistentToken;
+ }
+
+ public function getPersistentToken()
+ {
+ return $this->persistentToken;
+ }
+}