accounts/common/components/OAuth2/Entities/AccessTokenEntity.php

25 lines
740 B
PHP

<?php
declare(strict_types=1);
namespace common\components\OAuth2\Entities;
use League\OAuth2\Server\CryptKeyInterface;
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
use League\OAuth2\Server\Entities\Traits\EntityTrait;
use League\OAuth2\Server\Entities\Traits\TokenEntityTrait;
use Yii;
final class AccessTokenEntity implements AccessTokenEntityInterface {
use EntityTrait;
use TokenEntityTrait;
public function toString(): string {
return Yii::$app->tokensFactory->createForOAuthClient($this)->toString();
}
public function setPrivateKey(CryptKeyInterface $privateKey): void {
// We use a general-purpose component to build JWT tokens, so there is no need to keep the key
}
}