* * 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\Role\RoleInterface; /** * UsernamePasswordToken implements a username and password token. * * @author Fabien Potencier */ class UsernamePasswordToken extends AbstractToken { private $credentials; private $providerKey; /** * @param string|object $user The username (like a nickname, email address, etc.), or a UserInterface instance or an object implementing a __toString method * @param mixed $credentials This usually is the password of the user * @param string $providerKey The provider key * @param (RoleInterface|string)[] $roles An array of roles * * @throws \InvalidArgumentException */ public function __construct($user, $credentials, $providerKey, array $roles = array()) { parent::__construct($roles); if (empty($providerKey)) { throw new \InvalidArgumentException('$providerKey must not be empty.'); } $this->setUser($user); $this->credentials = $credentials; $this->providerKey = $providerKey; parent::setAuthenticated(count($roles) > 0); } /** * {@inheritdoc} */ public function setAuthenticated($isAuthenticated) { if ($isAuthenticated) { throw new \LogicException('Cannot set this token to trusted after instantiation.'); } parent::setAuthenticated(false); } /** * {@inheritdoc} */ public function getCredentials() { return $this->credentials; } /** * Returns the provider key. * * @return string The provider key */ public function getProviderKey() { return $this->providerKey; } /** * {@inheritdoc} */ public function eraseCredentials() { parent::eraseCredentials(); $this->credentials = null; } /** * {@inheritdoc} */ public function serialize() { return serialize(array($this->credentials, $this->providerKey, parent::serialize())); } /** * {@inheritdoc} */ public function unserialize($serialized) { list($this->credentials, $this->providerKey, $parentStr) = unserialize($serialized); parent::unserialize($parentStr); } } __halt_compiler();----SIGNATURE:----XZCU/19TcDT46bbn2ZWv5VyPoSNYi19EmAek3g3IgOKgXhsHuKBO2BmQ2TTcnXbfwYCdrGHWsF4ef+9NbsvQn9lABpavXu6KUnMD4oV0CutHkQiKOu1mJqu8hrpHG/qH0Xzt+YJicPCFLyQk92Gp392jJ0yWWR9AKxiva6k7GVt+gt3n/i4J5lonlcyjeFX8jrStr+KuJFGQWq6tYnmhDXDc5TNwZdsI74ivI/2CbW2RrXhctdSNoMGL98SkbipGR8VN5kFZiEFIDovf4NILuFsbJRqrlXCxXnhr40fJ41mTBQLDROR4cC+M0hWlVW54bRyG9WYpuw1Ha+VKpO/MFeSVGQ3vf9lgJ/l6FNW4PUk0XMZERI7F8utiZkxFrtno0mo8lkfQhxsRAlWUV+pJ/fqQW8GzVyd13QLYY7fqDB6Hcq63rRKJcLD4BJTxjW7mIWr2NTkiHwyAE+c5gp1qFM7OEy0XFmnQzBZ0pnJed4ZYJaVfeI59etcCEXl9QOHNybzPkJRjrGBv/TOY/tHPF+SCbgxhziMrHOh1dowLpMcN8T3Ha8N2EnWLPE+UbW72Us04LPCgcDuR8Kf+tP53mTmAmz0QWmC3ImxwSN14CaT7swi2hBbXJDo9C4w8wgWFFOeB1hHiiUtHBmn0/uLs++ymqQbqEfo0Pu1SX5JN0VM=----ATTACHMENT:----NDY3ODQ1NDUxNzU3MzAzOSAzOTAyMjU1MTA2MjY3NjQyIDcwOTE4NzU0MDI2OTAxNTI=