mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-01-19 01:52:57 +05:30
Removed id
property from token entities, just use token
now
This commit is contained in:
parent
2c732a6647
commit
e9d867ba95
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user