mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-23 05:29:52 +05:30
Lotsa bug fixes and updates
This commit is contained in:
parent
c6bc1b0cfc
commit
1e78f62823
@ -34,8 +34,10 @@ class ClientStorage extends Adapter implements ClientInterface
|
|||||||
|
|
||||||
if (count($result) === 1) {
|
if (count($result) === 1) {
|
||||||
$client = new ClientEntity($this->server);
|
$client = new ClientEntity($this->server);
|
||||||
$client->setId($result[0]['id']);
|
$client->hydrate([
|
||||||
$client->setName($result[0]['name']);
|
'id' => $result[0]['id'],
|
||||||
|
'name' => $result[0]['name']
|
||||||
|
]);
|
||||||
|
|
||||||
return $client;
|
return $client;
|
||||||
}
|
}
|
||||||
@ -56,8 +58,10 @@ class ClientStorage extends Adapter implements ClientInterface
|
|||||||
|
|
||||||
if (count($result) === 1) {
|
if (count($result) === 1) {
|
||||||
$client = new ClientEntity($this->server);
|
$client = new ClientEntity($this->server);
|
||||||
$client->setId($result[0]['id']);
|
$client->hydrate([
|
||||||
$client->setName($result[0]['name']);
|
'id' => $result[0]['id'],
|
||||||
|
'name' => $result[0]['name']
|
||||||
|
]);
|
||||||
|
|
||||||
return $client;
|
return $client;
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,9 @@ class ScopeStorage extends Adapter implements ScopeInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (new ScopeEntity($this->server))
|
return (new ScopeEntity($this->server))->hydrate([
|
||||||
->setId($result[0]['id'])
|
'id' => $result[0]['id'],
|
||||||
->setDescription($result[0]['description']);
|
'description' => $result[0]['description']
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ abstract class AbstractServer
|
|||||||
* Get the access token type
|
* Get the access token type
|
||||||
* @return TokenTypeInterface
|
* @return TokenTypeInterface
|
||||||
*/
|
*/
|
||||||
public function getIdType()
|
public function getTokenType()
|
||||||
{
|
{
|
||||||
return $this->tokenType;
|
return $this->tokenType;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ class AuthorizationServer extends AbstractServer
|
|||||||
$this->storages = [];
|
$this->storages = [];
|
||||||
|
|
||||||
// Set Bearer as the default token type
|
// Set Bearer as the default token type
|
||||||
$this->setTokenType(new Bearer);
|
$this->setIdType(new Bearer);
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
|
@ -21,10 +21,10 @@ use Symfony\Component\HttpFoundation\ParameterBag;
|
|||||||
abstract class AbstractTokenEntity
|
abstract class AbstractTokenEntity
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Access token ID
|
* Token identifier
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $token;
|
protected $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Associated session
|
* Associated session
|
||||||
@ -34,9 +34,9 @@ abstract class AbstractTokenEntity
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Session scopes
|
* Session scopes
|
||||||
* @var \Symfony\Component\HttpFoundation\ParameterBag
|
* @var array Array of ScopeEntity
|
||||||
*/
|
*/
|
||||||
protected $scopes;
|
protected $scopes = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Token expire time
|
* Token expire time
|
||||||
@ -96,13 +96,13 @@ abstract class AbstractTokenEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set access token ID
|
* Set token ID
|
||||||
* @param string $token Token ID
|
* @param string $token Token ID
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function setToken($token = null)
|
public function setId($id = null)
|
||||||
{
|
{
|
||||||
$this->token = ($token !== null) ? $token : SecureKey::generate();
|
$this->id = ($id !== null) ? $id : SecureKey::generate();
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -111,9 +111,9 @@ abstract class AbstractTokenEntity
|
|||||||
* Get the token ID
|
* Get the token ID
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getToken()
|
public function getId()
|
||||||
{
|
{
|
||||||
return $this->token;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -153,10 +153,10 @@ abstract class AbstractTokenEntity
|
|||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
if ($this->token === null) {
|
if ($this->id === null) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
return $this->token;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,7 +66,7 @@ class AccessTokenEntity extends AbstractTokenEntity
|
|||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
$this->server->getStorage('access_token')->create(
|
$this->server->getStorage('access_token')->create(
|
||||||
$this->getToken(),
|
$this->getId(),
|
||||||
$this->getExpireTime(),
|
$this->getExpireTime(),
|
||||||
$this->getSession()->getId()
|
$this->getSession()->getId()
|
||||||
);
|
);
|
||||||
|
@ -55,7 +55,7 @@ class AuthCodeEntity extends AbstractTokenEntity
|
|||||||
$uri .= (strstr($this->getRedirectUri(), $queryDelimeter) === false) ? $queryDelimeter : '&';
|
$uri .= (strstr($this->getRedirectUri(), $queryDelimeter) === false) ? $queryDelimeter : '&';
|
||||||
|
|
||||||
return $uri.http_build_query([
|
return $uri.http_build_query([
|
||||||
'code' => $this->getToken(),
|
'code' => $this->getId(),
|
||||||
'state' => $state
|
'state' => $state
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ class AuthCodeEntity extends AbstractTokenEntity
|
|||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
$this->server->getStorage('auth_code')->create(
|
$this->server->getStorage('auth_code')->create(
|
||||||
$this->getToken(),
|
$this->getId(),
|
||||||
$this->getExpireTime(),
|
$this->getExpireTime(),
|
||||||
$this->getSession()->getId()
|
$this->getSession()->getId()
|
||||||
);
|
);
|
||||||
|
@ -18,6 +18,8 @@ use League\OAuth2\Server\AbstractServer;
|
|||||||
*/
|
*/
|
||||||
class ClientEntity
|
class ClientEntity
|
||||||
{
|
{
|
||||||
|
use EntityTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client identifier
|
* Client identifier
|
||||||
* @var string
|
* @var string
|
||||||
@ -60,18 +62,6 @@ class ClientEntity
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the client identifier
|
|
||||||
* @param string $id
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public function setId($id)
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the client identifier
|
* Return the client identifier
|
||||||
* @return string
|
* @return string
|
||||||
@ -81,18 +71,6 @@ class ClientEntity
|
|||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the client secret
|
|
||||||
* @param string $secret
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public function setSecret($secret)
|
|
||||||
{
|
|
||||||
$this->secret = $secret;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the client secret
|
* Return the client secret
|
||||||
* @return string
|
* @return string
|
||||||
@ -102,18 +80,6 @@ class ClientEntity
|
|||||||
return $this->secret;
|
return $this->secret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the client name
|
|
||||||
* @param string $name
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public function setName($name)
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the client name
|
* Get the client name
|
||||||
* @return string
|
* @return string
|
||||||
@ -123,18 +89,6 @@ class ClientEntity
|
|||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the client redirect URI
|
|
||||||
* @param string $redirectUri
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public function setRedirectUri($redirectUri)
|
|
||||||
{
|
|
||||||
$this->redirectUri = $redirectUri;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returnt the client redirect URI
|
* Returnt the client redirect URI
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -19,10 +19,12 @@ trait EntityTrait
|
|||||||
*/
|
*/
|
||||||
public function hydrate(array $properties)
|
public function hydrate(array $properties)
|
||||||
{
|
{
|
||||||
foreach ($properties as $prop) {
|
foreach ($properties as $prop => $val) {
|
||||||
if (isset($this->{$prop})) {
|
if (property_exists($this, $prop)) {
|
||||||
$this->{$prop} = $prop;
|
$this->{$prop} = $val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,9 +53,9 @@ class RefreshTokenEntity extends AbstractTokenEntity
|
|||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
$this->server->getStorage('refresh_token')->create(
|
$this->server->getStorage('refresh_token')->create(
|
||||||
$this->getToken(),
|
$this->getId(),
|
||||||
$this->getExpireTime(),
|
$this->getExpireTime(),
|
||||||
$this->getAccessToken()->getToken()
|
$this->getAccessToken()->getId()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ use League\OAuth2\Server\AbstractServer;
|
|||||||
*/
|
*/
|
||||||
class ScopeEntity implements \JsonSerializable
|
class ScopeEntity implements \JsonSerializable
|
||||||
{
|
{
|
||||||
|
use EntityTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scope identifier
|
* Scope identifier
|
||||||
* @var string
|
* @var string
|
||||||
@ -48,18 +50,6 @@ class ScopeEntity implements \JsonSerializable
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the scope identifer
|
|
||||||
* @param string $id The scope identifier
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public function setId($id)
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the scope identifer
|
* Return the scope identifer
|
||||||
* @return string
|
* @return string
|
||||||
@ -69,18 +59,6 @@ class ScopeEntity implements \JsonSerializable
|
|||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the scope's descripton
|
|
||||||
* @param string $description
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public function setDescription($description)
|
|
||||||
{
|
|
||||||
$this->description = $description;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the scope's description
|
* Return the scope's description
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
namespace League\OAuth2\Server\Entity;
|
namespace League\OAuth2\Server\Entity;
|
||||||
|
|
||||||
use League\OAuth2\Server\AbstractServer;
|
use League\OAuth2\Server\AbstractServer;
|
||||||
|
use League\OAuth2\Server\Event;
|
||||||
use Symfony\Component\HttpFoundation\ParameterBag;
|
use Symfony\Component\HttpFoundation\ParameterBag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -228,7 +229,7 @@ class SessionEntity
|
|||||||
$this->ownerType = $type;
|
$this->ownerType = $type;
|
||||||
$this->ownerId = $id;
|
$this->ownerId = $id;
|
||||||
|
|
||||||
$this->server->eventEmitter->emit(new Event\SessionOwnerEvent($this));
|
$this->server->getEventEmitter()->emit(new Event\SessionOwnerEvent($this));
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -141,8 +141,8 @@ class AuthCodeGrant extends AbstractGrant
|
|||||||
|
|
||||||
// Create a new auth code
|
// Create a new auth code
|
||||||
$authCode = new AuthCodeEntity($this->server);
|
$authCode = new AuthCodeEntity($this->server);
|
||||||
$authCode->setToken(SecureKey::generate());
|
$authCode->setId(SecureKey::generate());
|
||||||
$authCode->setRedirectUri();
|
$authCode->setRedirectUri($authParams['redirect_uri']);
|
||||||
$authCode->setExpireTime(time() + $this->authTokenTTL);
|
$authCode->setExpireTime(time() + $this->authTokenTTL);
|
||||||
|
|
||||||
foreach ($authParams['scopes'] as $scope) {
|
foreach ($authParams['scopes'] as $scope) {
|
||||||
@ -210,23 +210,23 @@ class AuthCodeGrant extends AbstractGrant
|
|||||||
|
|
||||||
// Generate the access token
|
// Generate the access token
|
||||||
$accessToken = new AccessTokenEntity($this->server);
|
$accessToken = new AccessTokenEntity($this->server);
|
||||||
$accessToken->setToken(SecureKey::generate());
|
$accessToken->setId(SecureKey::generate());
|
||||||
$accessToken->setExpireTime($this->server->getAccessTokenTTL() + time());
|
$accessToken->setExpireTime($this->server->getAccessTokenTTL() + time());
|
||||||
|
|
||||||
foreach ($authCodeScopes as $authCodeScope) {
|
foreach ($authCodeScopes as $authCodeScope) {
|
||||||
$session->associateScope($authCodeScope);
|
$session->associateScope($authCodeScope);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->server->getTokenType()->set('access_token', $accessToken->getToken());
|
$this->server->getTokenType()->set('access_token', $accessToken->getId());
|
||||||
$this->server->getTokenType()->set('expires', $accessToken->getExpireTime());
|
$this->server->getTokenType()->set('expires', $accessToken->getExpireTime());
|
||||||
$this->server->getTokenType()->set('expires_in', $this->server->getAccessTokenTTL());
|
$this->server->getTokenType()->set('expires_in', $this->server->getAccessTokenTTL());
|
||||||
|
|
||||||
// Associate a refresh token if set
|
// Associate a refresh token if set
|
||||||
if ($this->server->hasGrantType('refresh_token')) {
|
if ($this->server->hasGrantType('refresh_token')) {
|
||||||
$refreshToken = new RefreshTokenEntity($this->server);
|
$refreshToken = new RefreshTokenEntity($this->server);
|
||||||
$refreshToken->setToken(SecureKey::generate());
|
$refreshToken->setId(SecureKey::generate());
|
||||||
$refreshToken->setExpireTime($this->server->getGrantType('refresh_token')->getRefreshTokenTTL() + time());
|
$refreshToken->setExpireTime($this->server->getGrantType('refresh_token')->getRefreshTokenTTL() + time());
|
||||||
$this->server->getTokenType()->set('refresh_token', $refreshToken->getToken());
|
$this->server->getTokenType()->set('refresh_token', $refreshToken->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expire the auth code
|
// Expire the auth code
|
||||||
|
@ -87,7 +87,7 @@ class ClientCredentialsGrant extends AbstractGrant
|
|||||||
|
|
||||||
// Generate an access token
|
// Generate an access token
|
||||||
$accessToken = new AccessTokenEntity($this->server);
|
$accessToken = new AccessTokenEntity($this->server);
|
||||||
$accessToken->setToken(SecureKey::generate());
|
$accessToken->setId(SecureKey::generate());
|
||||||
$accessToken->setExpireTime($this->server->getAccessTokenTTL() + time());
|
$accessToken->setExpireTime($this->server->getAccessTokenTTL() + time());
|
||||||
|
|
||||||
// Associate scopes with the session and access token
|
// Associate scopes with the session and access token
|
||||||
@ -101,7 +101,7 @@ class ClientCredentialsGrant extends AbstractGrant
|
|||||||
$accessToken->setSession($session);
|
$accessToken->setSession($session);
|
||||||
$accessToken->save($this->server->getStorage('access_token'));
|
$accessToken->save($this->server->getStorage('access_token'));
|
||||||
|
|
||||||
$this->server->getTokenType()->set('access_token', $accessToken->getToken());
|
$this->server->getTokenType()->set('access_token', $accessToken->getId());
|
||||||
$this->server->getTokenType()->set('expires', $accessToken->getExpireTime());
|
$this->server->getTokenType()->set('expires', $accessToken->getExpireTime());
|
||||||
$this->server->getTokenType()->set('expires_in', $this->server->getAccessTokenTTL());
|
$this->server->getTokenType()->set('expires_in', $this->server->getAccessTokenTTL());
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ class PasswordGrant extends AbstractGrant
|
|||||||
|
|
||||||
// Generate an access token
|
// Generate an access token
|
||||||
$accessToken = new AccessTokenEntity($this->server);
|
$accessToken = new AccessTokenEntity($this->server);
|
||||||
$accessToken->setToken(SecureKey::generate());
|
$accessToken->setId(SecureKey::generate());
|
||||||
$accessToken->setExpireTime($this->server->getAccessTokenTTL() + time());
|
$accessToken->setExpireTime($this->server->getAccessTokenTTL() + time());
|
||||||
|
|
||||||
// Associate scopes with the session and access token
|
// Associate scopes with the session and access token
|
||||||
@ -136,16 +136,16 @@ class PasswordGrant extends AbstractGrant
|
|||||||
$session->associateScope($scope);
|
$session->associateScope($scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->server->getTokenType()->set('access_token', $accessToken->getToken());
|
$this->server->getTokenType()->set('access_token', $accessToken->getId());
|
||||||
$this->server->getTokenType()->set('expires', $accessToken->getExpireTime());
|
$this->server->getTokenType()->set('expires', $accessToken->getExpireTime());
|
||||||
$this->server->getTokenType()->set('expires_in', $this->server->getAccessTokenTTL());
|
$this->server->getTokenType()->set('expires_in', $this->server->getAccessTokenTTL());
|
||||||
|
|
||||||
// Associate a refresh token if set
|
// Associate a refresh token if set
|
||||||
if ($this->server->hasGrantType('refresh_token')) {
|
if ($this->server->hasGrantType('refresh_token')) {
|
||||||
$refreshToken = new RefreshTokenEntity($this->server);
|
$refreshToken = new RefreshTokenEntity($this->server);
|
||||||
$refreshToken->setToken(SecureKey::generate());
|
$refreshToken->setId(SecureKey::generate());
|
||||||
$refreshToken->setExpireTime($this->server->getGrantType('refresh_token')->getRefreshTokenTTL() + time());
|
$refreshToken->setExpireTime($this->server->getGrantType('refresh_token')->getRefreshTokenTTL() + time());
|
||||||
$this->server->getTokenType()->set('refresh_token', $refreshToken->getToken());
|
$this->server->getTokenType()->set('refresh_token', $refreshToken->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save everything
|
// Save everything
|
||||||
|
@ -119,7 +119,7 @@ class RefreshTokenGrant extends AbstractGrant
|
|||||||
|
|
||||||
// Generate a new access token and assign it the correct sessions
|
// Generate a new access token and assign it the correct sessions
|
||||||
$newAccessToken = new AccessTokenEntity($this->server);
|
$newAccessToken = new AccessTokenEntity($this->server);
|
||||||
$newAccessToken->setToken(SecureKey::generate());
|
$newAccessToken->setId(SecureKey::generate());
|
||||||
$newAccessToken->setExpireTime($this->server->getAccessTokenTTL() + time());
|
$newAccessToken->setExpireTime($this->server->getAccessTokenTTL() + time());
|
||||||
$newAccessToken->setSession($session);
|
$newAccessToken->setSession($session);
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ class RefreshTokenGrant extends AbstractGrant
|
|||||||
$oldAccessToken->expire($this->server->getStorage('access_token'));
|
$oldAccessToken->expire($this->server->getStorage('access_token'));
|
||||||
$newAccessToken->save($this->server->getStorage('access_token'));
|
$newAccessToken->save($this->server->getStorage('access_token'));
|
||||||
|
|
||||||
$this->server->getTokenType()->set('access_token', $newAccessToken->getToken());
|
$this->server->getTokenType()->set('access_token', $newAccessToken->getId());
|
||||||
$this->server->getTokenType()->set('expires', $newAccessToken->getExpireTime());
|
$this->server->getTokenType()->set('expires', $newAccessToken->getExpireTime());
|
||||||
$this->server->getTokenType()->set('expires_in', $this->server->getAccessTokenTTL());
|
$this->server->getTokenType()->set('expires_in', $this->server->getAccessTokenTTL());
|
||||||
|
|
||||||
@ -140,12 +140,12 @@ class RefreshTokenGrant extends AbstractGrant
|
|||||||
|
|
||||||
// Generate a new refresh token
|
// Generate a new refresh token
|
||||||
$newRefreshToken = new RefreshTokenEntity($this->server);
|
$newRefreshToken = new RefreshTokenEntity($this->server);
|
||||||
$newRefreshToken->setToken(SecureKey::generate());
|
$newRefreshToken->setId(SecureKey::generate());
|
||||||
$newRefreshToken->setExpireTime($this->getRefreshTokenTTL() + time());
|
$newRefreshToken->setExpireTime($this->getRefreshTokenTTL() + time());
|
||||||
$newRefreshToken->setAccessToken($newAccessToken);
|
$newRefreshToken->setAccessToken($newAccessToken);
|
||||||
$newRefreshToken->save($this->server->getStorage('refresh_token'));
|
$newRefreshToken->save($this->server->getStorage('refresh_token'));
|
||||||
|
|
||||||
$this->server->getTokenType()->set('refresh_token', $newRefreshToken->getToken());
|
$this->server->getTokenType()->set('refresh_token', $newRefreshToken->getId());
|
||||||
|
|
||||||
return $this->server->getTokenType()->generateResponse();
|
return $this->server->getTokenType()->generateResponse();
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ class ResourceServer extends AbstractServer
|
|||||||
$this->setStorage('scope', $scopeStorage);
|
$this->setStorage('scope', $scopeStorage);
|
||||||
|
|
||||||
// Set Bearer as the default token type
|
// Set Bearer as the default token type
|
||||||
$this->setTokenType(new Bearer);
|
$this->setIdType(new Bearer);
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ class ResourceServer extends AbstractServer
|
|||||||
* Returns the query string key for the access token.
|
* Returns the query string key for the access token.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getTokenKey()
|
public function getIdKey()
|
||||||
{
|
{
|
||||||
return $this->tokenKey;
|
return $this->tokenKey;
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ class ResourceServer extends AbstractServer
|
|||||||
* @param $key The new query string key
|
* @param $key The new query string key
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function setTokenKey($key)
|
public function setIdKey($key)
|
||||||
{
|
{
|
||||||
$this->tokenKey = $key;
|
$this->tokenKey = $key;
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ class ResourceServer extends AbstractServer
|
|||||||
*/
|
*/
|
||||||
public function getAccessToken()
|
public function getAccessToken()
|
||||||
{
|
{
|
||||||
return $this->accessToken->getToken();
|
return $this->accessToken->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user