Removed id property from token entities, just use token now

This commit is contained in:
Alex Bilbie 2013-12-31 15:35:51 +00:00
parent 2c732a6647
commit e9d867ba95
3 changed files with 13 additions and 13 deletions

View File

@ -12,7 +12,7 @@ abstract class AbstractToken
* Access token ID * Access token ID
* @var string * @var string
*/ */
protected $id = null; protected $token = null;
/** /**
* Access token storage * Access token storage
@ -129,12 +129,12 @@ abstract class AbstractToken
/** /**
* Set access token ID * Set access token ID
* @param string $id Token ID * @param string $token Token ID
* @return self * @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; return $this;
} }
@ -142,9 +142,9 @@ abstract class AbstractToken
* Get the token ID * Get the token ID
* @return string * @return string
*/ */
public function getId() public function getToken()
{ {
return $this->id; return $this->token;
} }
/** /**

View File

@ -23,14 +23,14 @@ class AccessToken extends AbstractToken
public function save() public function save()
{ {
$this->getStorage()->createAccessToken( $this->getStorage()->createAccessToken(
$this->getId(), $this->getToken(),
$this->getExpireTime(), $this->getExpireTime(),
$this->getSession()->getId() $this->getSession()->getId()
); );
// Associate the scope with the token // Associate the scope with the token
foreach ($this->getScopes() as $scope) { foreach ($this->getScopes() as $scope) {
$this->getStorage()->associateScope($this->getId(), $scope->getId()); $this->getStorage()->associateScope($this->getToken(), $scope->getId());
} }
return $this; return $this;

View File

@ -47,15 +47,15 @@ class RefreshToken extends AbstractToken
*/ */
public function save() public function save()
{ {
/*$this->getStorage()->createAccessToken( $this->getStorage()->createAccessToken(
$this->getId(), $this->getToken(),
$this->getExpireTime(), $this->getExpireTime(),
$this->getAccessToken()->getId() $this->getAccessToken()->getToken()
); );
// Associate the scope with the token // Associate the scope with the token
foreach ($this->getScopes() as $scope) { foreach ($this->getScopes() as $scope) {
$this->getStorage()->associateScope($this->getId(), $scope->getId()); $this->getStorage()->associateScope($this->getToken(), $scope->getId());
}*/ }
} }
} }