Source of file RememberMeToken.php
Size: 2,188 Bytes - Last Modified: 2013-07-17T08:22:21+02:00
/home/theseer/Downloads/Symfony/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Token/RememberMeToken.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 | <?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\Authentication\Token; use Symfony\Component\Security\Core\User\UserInterface; /** * Authentication Token for "Remember-Me". * * @author Johannes M. Schmitt <schmittjoh@gmail.com> */ class RememberMeToken extends AbstractToken { private $key; private $providerKey; /** * Constructor. * * @param UserInterface $user * @param string $providerKey * @param string $key * * @throws \InvalidArgumentException */ public function __construct(UserInterface $user, $providerKey, $key) { parent::__construct($user->getRoles()); if (empty($key)) { throw new \InvalidArgumentException('$key must not be empty.'); } if (empty($providerKey)) { throw new \InvalidArgumentException('$providerKey must not be empty.'); } $this->providerKey = $providerKey; $this->key = $key; $this->setUser($user); parent::setAuthenticated(true); } public function setAuthenticated($authenticated) { if ($authenticated) { throw new \LogicException('You cannot set this token to authenticated after creation.'); } parent::setAuthenticated(false); } public function getProviderKey() { return $this->providerKey; } public function getKey() { return $this->key; } public function getCredentials() { return ''; } /** * {@inheritdoc} */ public function serialize() { return serialize(array( $this->key, $this->providerKey, parent::serialize(), )); } /** * {@inheritdoc} */ public function unserialize($serialized) { list($this->key, $this->providerKey, $parentStr) = unserialize($serialized); parent::unserialize($parentStr); } } |