2016-02-14 23:20:10 +05:30
|
|
|
<?php
|
2019-09-22 02:47:21 +05:30
|
|
|
declare(strict_types=1);
|
2016-02-14 23:20:10 +05:30
|
|
|
|
2019-09-22 02:47:21 +05:30
|
|
|
namespace api\components\OAuth2\Entities;
|
2016-02-14 23:20:10 +05:30
|
|
|
|
2019-09-22 02:47:21 +05:30
|
|
|
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;
|
2019-12-04 23:40:15 +05:30
|
|
|
use Yii;
|
2016-02-14 23:20:10 +05:30
|
|
|
|
2019-09-22 02:47:21 +05:30
|
|
|
class AccessTokenEntity implements AccessTokenEntityInterface {
|
|
|
|
use EntityTrait;
|
2019-12-09 22:01:54 +05:30
|
|
|
use TokenEntityTrait;
|
2016-02-14 23:20:10 +05:30
|
|
|
|
2019-09-22 02:47:21 +05:30
|
|
|
public function __toString(): string {
|
2019-12-09 22:01:54 +05:30
|
|
|
return (string)Yii::$app->tokensFactory->createForOAuthClient($this);
|
2016-11-30 04:49:14 +05:30
|
|
|
}
|
|
|
|
|
2019-09-22 02:47:21 +05:30
|
|
|
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
|
2016-02-14 23:20:10 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
}
|