Добавлен роут и логика для обновления access_token по refresh_token'у

This commit is contained in:
ErickSkrauch
2016-05-31 01:03:30 +03:00
parent cb038c897b
commit 1945a7baec
9 changed files with 258 additions and 3 deletions

View File

@@ -0,0 +1,42 @@
<?php
namespace api\components\User;
use Yii;
use yii\web\IdentityInterface;
class RenewResult {
/**
* @var IdentityInterface
*/
private $identity;
/**
* @var string
*/
private $jwt;
public function __construct(IdentityInterface $identity, string $jwt) {
$this->identity = $identity;
$this->jwt = $jwt;
}
public function getIdentity() : IdentityInterface {
return $this->identity;
}
public function getJwt() : string {
return $this->jwt;
}
public function getAsResponse() {
/** @var Component $component */
$component = Yii::$app->user;
return [
'access_token' => $this->getJwt(),
'expires_in' => $component->expirationTimeout,
];
}
}