diff options
Diffstat (limited to 'Authentication/Token/PreAuthenticatedToken.php')
-rw-r--r-- | Authentication/Token/PreAuthenticatedToken.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Authentication/Token/PreAuthenticatedToken.php b/Authentication/Token/PreAuthenticatedToken.php new file mode 100644 index 0000000..7466757 --- /dev/null +++ b/Authentication/Token/PreAuthenticatedToken.php @@ -0,0 +1,44 @@ +<?php + +namespace Symfony\Component\Security\Authentication\Token; + +/* + * This file is part of the Symfony package. + * + * (c) Fabien Potencier <fabien.potencier@symfony-project.com> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * PreAuthenticatedToken implements a pre-authenticated token. + * + * @author Fabien Potencier <fabien.potencier@symfony-project.com> + */ +class PreAuthenticatedToken extends Token +{ + /** + * Constructor. + */ + public function __construct($user, $credentials, array $roles = null) + { + if (null !== $roles) { + parent::__construct($roles); + $this->setAuthenticated(true); + } + + $this->user = $user; + $this->credentials = $credentials; + } + + /** + * {@inheritdoc} + */ + public function eraseCredentials() + { + parent::eraseCredentials(); + + $this->credentials = null; + } +} |