mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-01-05 19:43:56 +05:30
Inject the session into the token type
This commit is contained in:
parent
a3f5d20592
commit
536ef3244d
@ -230,6 +230,7 @@ class AuthCodeGrant extends AbstractGrant
|
|||||||
$accessToken->associateScope($scope);
|
$accessToken->associateScope($scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->server->getTokenType()->setSession($session);
|
||||||
$this->server->getTokenType()->setParam('access_token', $accessToken->getId());
|
$this->server->getTokenType()->setParam('access_token', $accessToken->getId());
|
||||||
$this->server->getTokenType()->setParam('expires_in', $this->getAccessTokenTTL());
|
$this->server->getTokenType()->setParam('expires_in', $this->getAccessTokenTTL());
|
||||||
|
|
||||||
|
@ -112,6 +112,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()->setSession($session);
|
||||||
$this->server->getTokenType()->setParam('access_token', $accessToken->getId());
|
$this->server->getTokenType()->setParam('access_token', $accessToken->getId());
|
||||||
$this->server->getTokenType()->setParam('expires_in', $this->getAccessTokenTTL());
|
$this->server->getTokenType()->setParam('expires_in', $this->getAccessTokenTTL());
|
||||||
|
|
||||||
|
@ -148,6 +148,7 @@ class PasswordGrant extends AbstractGrant
|
|||||||
$accessToken->associateScope($scope);
|
$accessToken->associateScope($scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->server->getTokenType()->setSession($session);
|
||||||
$this->server->getTokenType()->setParam('access_token', $accessToken->getId());
|
$this->server->getTokenType()->setParam('access_token', $accessToken->getId());
|
||||||
$this->server->getTokenType()->setParam('expires_in', $this->getAccessTokenTTL());
|
$this->server->getTokenType()->setParam('expires_in', $this->getAccessTokenTTL());
|
||||||
|
|
||||||
|
@ -139,6 +139,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()->setSession($session);
|
||||||
$this->server->getTokenType()->setParam('access_token', $newAccessToken->getId());
|
$this->server->getTokenType()->setParam('access_token', $newAccessToken->getId());
|
||||||
$this->server->getTokenType()->setParam('expires_in', $this->getAccessTokenTTL());
|
$this->server->getTokenType()->setParam('expires_in', $this->getAccessTokenTTL());
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ namespace League\OAuth2\Server\TokenType;
|
|||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use League\OAuth2\Server\AbstractServer;
|
use League\OAuth2\Server\AbstractServer;
|
||||||
|
use League\OAuth2\Server\Entity\SessionEntity;
|
||||||
|
|
||||||
abstract class AbstractTokenType
|
abstract class AbstractTokenType
|
||||||
{
|
{
|
||||||
@ -28,6 +29,12 @@ abstract class AbstractTokenType
|
|||||||
*/
|
*/
|
||||||
protected $server;
|
protected $server;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Server
|
||||||
|
* @var \League\OAuth2\Server\Entity\SessionEntity $session
|
||||||
|
*/
|
||||||
|
protected $session;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the server
|
* Set the server
|
||||||
* @param \League\OAuth2\Server\AbstractServer $server
|
* @param \League\OAuth2\Server\AbstractServer $server
|
||||||
@ -38,6 +45,17 @@ abstract class AbstractTokenType
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the session entity
|
||||||
|
* @param \League\OAuth2\Server\Entity\SessionEntity $session
|
||||||
|
*/
|
||||||
|
public function setSession(SessionEntity $session)
|
||||||
|
{
|
||||||
|
$this->session = $session;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* Set a key/value response pair
|
* Set a key/value response pair
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
|
Loading…
Reference in New Issue
Block a user