2016-11-29 04:27:58 +05:30
|
|
|
<?php
|
2019-08-02 21:02:08 +05:30
|
|
|
declare(strict_types=1);
|
|
|
|
|
2016-11-29 04:27:58 +05:30
|
|
|
namespace api\components\OAuth2\Entities;
|
|
|
|
|
2019-09-22 05:12:08 +05:30
|
|
|
use Carbon\CarbonImmutable;
|
|
|
|
use DateTimeImmutable;
|
2019-08-23 13:58:04 +05:30
|
|
|
use League\OAuth2\Server\Entities\RefreshTokenEntityInterface;
|
|
|
|
use League\OAuth2\Server\Entities\Traits\EntityTrait;
|
|
|
|
use League\OAuth2\Server\Entities\Traits\RefreshTokenTrait;
|
2016-11-30 04:49:14 +05:30
|
|
|
|
2019-08-23 13:58:04 +05:30
|
|
|
class RefreshTokenEntity implements RefreshTokenEntityInterface {
|
|
|
|
use EntityTrait;
|
|
|
|
use RefreshTokenTrait;
|
2016-11-30 04:49:14 +05:30
|
|
|
|
2019-09-22 05:12:08 +05:30
|
|
|
/**
|
|
|
|
* We don't rotate refresh tokens, so that to always pass validation in the internal validator
|
|
|
|
* of the oauth2 server implementation we set the lifetime as far as possible.
|
|
|
|
*
|
|
|
|
* In 2038 this may cause problems, but I am sure that by then this code, if it still works,
|
|
|
|
* will be rewritten several times and the problem will be solved in a completely different way.
|
|
|
|
*
|
|
|
|
* @return DateTimeImmutable
|
|
|
|
*/
|
|
|
|
public function getExpiryDateTime(): DateTimeImmutable {
|
|
|
|
return CarbonImmutable::create(2038, 11, 11, 22, 13, 0, 'Europe/Minsk');
|
|
|
|
}
|
|
|
|
|
2016-11-29 04:27:58 +05:30
|
|
|
}
|