diff options
author | WouterJ <waldio.webdesign@gmail.com> | 2015-06-29 13:59:59 +0200 |
---|---|---|
committer | Fabien Potencier <fabien.potencier@gmail.com> | 2015-07-02 01:04:13 +0200 |
commit | cba12eee6f9d829e7c2307982513d01b99830b83 (patch) | |
tree | aed03cf12bf56633ae29157a27a3305e5557f770 /Core/Authentication/Token/AnonymousToken.php | |
parent | c839c1382bfd96b6a356a2e9498bf5bd1ff775c1 (diff) | |
download | symfony-security-cba12eee6f9d829e7c2307982513d01b99830b83.zip symfony-security-cba12eee6f9d829e7c2307982513d01b99830b83.tar.gz symfony-security-cba12eee6f9d829e7c2307982513d01b99830b83.tar.bz2 |
[DX] [Security] Renamed Token#getKey() to getSecret()
Diffstat (limited to 'Core/Authentication/Token/AnonymousToken.php')
-rw-r--r-- | Core/Authentication/Token/AnonymousToken.php | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/Core/Authentication/Token/AnonymousToken.php b/Core/Authentication/Token/AnonymousToken.php index 571816c..22fc611 100644 --- a/Core/Authentication/Token/AnonymousToken.php +++ b/Core/Authentication/Token/AnonymousToken.php @@ -20,20 +20,20 @@ use Symfony\Component\Security\Core\Role\RoleInterface; */ class AnonymousToken extends AbstractToken { - private $key; + private $secret; /** * Constructor. * - * @param string $key The key shared with the authentication provider - * @param string $user The user - * @param RoleInterface[] $roles An array of roles + * @param string $secret A secret used to make sure the token is created by the app and not by a malicious client + * @param string $user The user + * @param RoleInterface[] $roles An array of roles */ - public function __construct($key, $user, array $roles = array()) + public function __construct($secret, $user, array $roles = array()) { parent::__construct($roles); - $this->key = $key; + $this->secret = $secret; $this->setUser($user); $this->setAuthenticated(true); } @@ -47,13 +47,23 @@ class AnonymousToken extends AbstractToken } /** - * Returns the key. - * - * @return string The Key + * @deprecated Since version 2.8, to be removed in 3.0. Use getSecret() instead. */ public function getKey() { - return $this->key; + @trigger_error(__method__.'() is deprecated since version 2.8 and will be removed in 3.0. Use getSecret() instead.', E_USER_DEPRECATED); + + return $this->getSecret(); + } + + /** + * Returns the secret. + * + * @return string + */ + public function getSecret() + { + return $this->secret; } /** @@ -61,7 +71,7 @@ class AnonymousToken extends AbstractToken */ public function serialize() { - return serialize(array($this->key, parent::serialize())); + return serialize(array($this->secret, parent::serialize())); } /** @@ -69,7 +79,7 @@ class AnonymousToken extends AbstractToken */ public function unserialize($serialized) { - list($this->key, $parentStr) = unserialize($serialized); + list($this->secret, $parentStr) = unserialize($serialized); parent::unserialize($parentStr); } } |