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