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
* @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;
}
/**

View File

@ -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;

View File

@ -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());
}
}
}