[Security] fixed a Token serialization bug
This commit is contained in:
parent
fbc21fedf7
commit
4d5853866a
@ -18,8 +18,6 @@ namespace Symfony\Component\Security\Core\Authentication\Token;
|
|||||||
*/
|
*/
|
||||||
class PreAuthenticatedToken extends Token
|
class PreAuthenticatedToken extends Token
|
||||||
{
|
{
|
||||||
protected $providerKey;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
@ -35,11 +33,6 @@ class PreAuthenticatedToken extends Token
|
|||||||
$this->providerKey = $providerKey;
|
$this->providerKey = $providerKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getProviderKey()
|
|
||||||
{
|
|
||||||
return $this->providerKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
@ -22,7 +22,6 @@ use Symfony\Component\Security\Core\User\AccountInterface;
|
|||||||
class RememberMeToken extends Token
|
class RememberMeToken extends Token
|
||||||
{
|
{
|
||||||
protected $key;
|
protected $key;
|
||||||
protected $providerKey;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The persistent token which resulted in this authentication token.
|
* The persistent token which resulted in this authentication token.
|
||||||
@ -53,11 +52,6 @@ class RememberMeToken extends Token
|
|||||||
$this->setAuthenticated(true);
|
$this->setAuthenticated(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getProviderKey()
|
|
||||||
{
|
|
||||||
return $this->providerKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getKey()
|
public function getKey()
|
||||||
{
|
{
|
||||||
return $this->key;
|
return $this->key;
|
||||||
|
@ -28,6 +28,7 @@ abstract class Token implements TokenInterface
|
|||||||
protected $user;
|
protected $user;
|
||||||
protected $credentials;
|
protected $credentials;
|
||||||
protected $immutable;
|
protected $immutable;
|
||||||
|
protected $providerKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@ -181,12 +182,20 @@ abstract class Token implements TokenInterface
|
|||||||
$this->immutable = true;
|
$this->immutable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getProviderKey()
|
||||||
|
{
|
||||||
|
return $this->providerKey;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function serialize()
|
public function serialize()
|
||||||
{
|
{
|
||||||
return serialize(array($this->user, $this->credentials, $this->authenticated, $this->roles, $this->immutable));
|
return serialize(array($this->user, $this->credentials, $this->authenticated, $this->roles, $this->immutable, $this->providerKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -194,6 +203,6 @@ abstract class Token implements TokenInterface
|
|||||||
*/
|
*/
|
||||||
public function unserialize($serialized)
|
public function unserialize($serialized)
|
||||||
{
|
{
|
||||||
list($this->user, $this->credentials, $this->authenticated, $this->roles, $this->immutable) = unserialize($serialized);
|
list($this->user, $this->credentials, $this->authenticated, $this->roles, $this->immutable, $this->providerKey) = unserialize($serialized);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,11 +18,9 @@ namespace Symfony\Component\Security\Core\Authentication\Token;
|
|||||||
*/
|
*/
|
||||||
class UsernamePasswordToken extends Token
|
class UsernamePasswordToken extends Token
|
||||||
{
|
{
|
||||||
protected $providerKey;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param string $user The username (like a nickname, email address, etc.)
|
* @param string $user The username (like a nickname, email address, etc.)
|
||||||
* @param string $credentials This usually is the password of the user
|
* @param string $credentials This usually is the password of the user
|
||||||
*/
|
*/
|
||||||
@ -37,11 +35,6 @@ class UsernamePasswordToken extends Token
|
|||||||
parent::setAuthenticated((Boolean) count($roles));
|
parent::setAuthenticated((Boolean) count($roles));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getProviderKey()
|
|
||||||
{
|
|
||||||
return $this->providerKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user