mirror of
https://github.com/elyby/accounts.git
synced 2024-12-11 16:09:25 +05:30
24 lines
751 B
PHP
24 lines
751 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace api\components\OAuth2\Grants;
|
|
|
|
use api\components\OAuth2\Repositories\PublicScopeRepository;
|
|
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
|
|
use League\OAuth2\Server\Entities\RefreshTokenEntityInterface;
|
|
use League\OAuth2\Server\Grant\AuthCodeGrant as BaseAuthCodeGrant;
|
|
|
|
class AuthCodeGrant extends BaseAuthCodeGrant {
|
|
|
|
protected function issueRefreshToken(AccessTokenEntityInterface $accessToken): ?RefreshTokenEntityInterface {
|
|
foreach ($accessToken->getScopes() as $scope) {
|
|
if ($scope->getIdentifier() === PublicScopeRepository::OFFLINE_ACCESS) {
|
|
return parent::issueRefreshToken($accessToken);
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
}
|