* * 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:----CIedERgnlpkkJ2Urjd9Bj3ac1oQQeThfszPnmq23bpEj96bxGdPj9G1CWmt0NnX1MhvsoEaYNxGXOjc8GpuJIDjdGpUHw3JU92vOQJ2TOywhSiiUFhTp9Srv4Mqno7p+JoasHSXFs/0yOEah77M0UjvAUhhYhK/+P2Y2Rwjvrq9fuxJyOATtXIipAh9coKu1c4sh0TglC/aJHL8Pn3B1gOXVsLYk2qqaFjsoihJDlB/3sMJpITA7MpVOMTbB97jcmxUUgPefV3P/a3BuvriWQKDASC9KcKngi0nekIeWSocdtpAPgbQro8Xd/7HNC6gASFoZRnhpTlqlmI3qF8AxJ3rX8n85pNERsLEX5dvWNRFJuW7gb7QZD/TjXTRGmTnW15F5KrnzUtJhs+WSeuWlA/k43thFWxqsbtrbOe7gjGksiMU0TXhcGoYLzi0pMJD1y9pNdOD9j9B3/mJJHQ2AXMuvJsoepowP3WgmVpII6k7UdK32G7l9rUGu7l/vUK0N0bA5xWKNRgu+zJJpMfn7dSr2nLDl9kMbkGESfFHJ6BWZ0jCTqxIretenZrLCDJOO7UjVAPbWaSewkREL+XxmyhEHTno9LaXeYShSafB/dusbmKcpaUU9FjFXAurUsI7pmSUPj4Aj+MaGT7l5AoOXccVxMeXaXFiALnwWpxrK3e8=----ATTACHMENT:----NTE1NDExMDY4Njg0ODUzMyAzODM0NDUxNjEzNjE5MjI5IDQ0NzcxODc0NDg5NjYwNzg=