From e9d867ba95fcc69477287bf6a91ea22142784cb0 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Tue, 31 Dec 2013 15:35:51 +0000 Subject: [PATCH] Removed `id` property from token entities, just use `token` now --- src/League/OAuth2/Server/Entities/AbstractToken.php | 12 ++++++------ src/League/OAuth2/Server/Entities/AccessToken.php | 4 ++-- src/League/OAuth2/Server/Entities/RefreshToken.php | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/League/OAuth2/Server/Entities/AbstractToken.php b/src/League/OAuth2/Server/Entities/AbstractToken.php index ad3374d5..7a839a9d 100644 --- a/src/League/OAuth2/Server/Entities/AbstractToken.php +++ b/src/League/OAuth2/Server/Entities/AbstractToken.php @@ -12,7 +12,7 @@ abstract class AbstractToken * Access token ID * @var string */ - protected $id = null; + protected $token = null; /** * Access token storage @@ -129,12 +129,12 @@ abstract class AbstractToken /** * Set access token ID - * @param string $id Token ID + * @param string $token Token ID * @return self */ - public function setId($id = null) + public function setToken($token = null) { - $this->id = ($id !== null) ? $id : SecureKey::make(); + $this->token = ($token !== null) ? $token : SecureKey::make(); return $this; } @@ -142,9 +142,9 @@ abstract class AbstractToken * Get the token ID * @return string */ - public function getId() + public function getToken() { - return $this->id; + return $this->token; } /** diff --git a/src/League/OAuth2/Server/Entities/AccessToken.php b/src/League/OAuth2/Server/Entities/AccessToken.php index b0ce4bc0..4f52d32f 100644 --- a/src/League/OAuth2/Server/Entities/AccessToken.php +++ b/src/League/OAuth2/Server/Entities/AccessToken.php @@ -23,14 +23,14 @@ class AccessToken extends AbstractToken public function save() { $this->getStorage()->createAccessToken( - $this->getId(), + $this->getToken(), $this->getExpireTime(), $this->getSession()->getId() ); // Associate the scope with the token foreach ($this->getScopes() as $scope) { - $this->getStorage()->associateScope($this->getId(), $scope->getId()); + $this->getStorage()->associateScope($this->getToken(), $scope->getId()); } return $this; diff --git a/src/League/OAuth2/Server/Entities/RefreshToken.php b/src/League/OAuth2/Server/Entities/RefreshToken.php index 2900bec2..e8a89d59 100644 --- a/src/League/OAuth2/Server/Entities/RefreshToken.php +++ b/src/League/OAuth2/Server/Entities/RefreshToken.php @@ -47,15 +47,15 @@ class RefreshToken extends AbstractToken */ public function save() { - /*$this->getStorage()->createAccessToken( - $this->getId(), + $this->getStorage()->createAccessToken( + $this->getToken(), $this->getExpireTime(), - $this->getAccessToken()->getId() + $this->getAccessToken()->getToken() ); // Associate the scope with the token foreach ($this->getScopes() as $scope) { - $this->getStorage()->associateScope($this->getId(), $scope->getId()); - }*/ + $this->getStorage()->associateScope($this->getToken(), $scope->getId()); + } } }