mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-18 11:09:49 +05:30
62 lines
1.4 KiB
PHP
62 lines
1.4 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace League\OAuth2\Server\Entities;
|
||
|
|
||
|
use League\OAuth2\Server\Storage\SessionStorageInterface;
|
||
|
use League\OAuth2\Server\Storage\RefreshTokenInterface;
|
||
|
use Symfony\Component\HttpFoundation\ParameterBag;
|
||
|
use League\OAuth2\Server\Util\SecureKey;
|
||
|
use League\OAuth2\Server\Exception\InvalidAccessTokenException;
|
||
|
|
||
|
class RefreshToken extends AbstractToken
|
||
|
{
|
||
|
protected $accessToken;
|
||
|
|
||
|
/**
|
||
|
* __construct
|
||
|
* @param RefreshTokenInterface $storage
|
||
|
* @return self
|
||
|
*/
|
||
|
public function __construct(RefreshTokenInterface $storage)
|
||
|
{
|
||
|
parent::__construct($storage);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Associate an access token
|
||
|
* @param AccessToken $accessToken
|
||
|
* @return self
|
||
|
*/
|
||
|
public function setAccessToken(AccessToken $accessToken)
|
||
|
{
|
||
|
$this->accessToken = $accessToken;
|
||
|
return $this;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Return access token
|
||
|
* @return AccessToken
|
||
|
*/
|
||
|
public function getAccessToken()
|
||
|
{
|
||
|
return $this->accessToken;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* (@inheritdoc)
|
||
|
*/
|
||
|
public function save()
|
||
|
{
|
||
|
/*$this->getStorage()->createAccessToken(
|
||
|
$this->getId(),
|
||
|
$this->getExpireTime(),
|
||
|
$this->getAccessToken()->getId()
|
||
|
);
|
||
|
|
||
|
// Associate the scope with the token
|
||
|
foreach ($this->getScopes() as $scope) {
|
||
|
$this->getStorage()->associateScope($this->getId(), $scope->getId());
|
||
|
}*/
|
||
|
}
|
||
|
}
|