mirror of
https://github.com/elyby/accounts.git
synced 2024-11-27 01:02:06 +05:30
Не логгируем InvalidSubjectException, возникающий из-за перехода на новый формат токенов
This commit is contained in:
parent
58d3fd57a8
commit
c7cf54f32f
@ -4,6 +4,7 @@ namespace api\components\User;
|
|||||||
use common\models\Account;
|
use common\models\Account;
|
||||||
use Emarref\Jwt\Claim\Subject;
|
use Emarref\Jwt\Claim\Subject;
|
||||||
use Emarref\Jwt\Exception\ExpiredException;
|
use Emarref\Jwt\Exception\ExpiredException;
|
||||||
|
use Emarref\Jwt\Exception\InvalidSubjectException;
|
||||||
use Emarref\Jwt\Token;
|
use Emarref\Jwt\Token;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Yii;
|
use Yii;
|
||||||
@ -28,7 +29,8 @@ class JwtIdentity implements IdentityInterface {
|
|||||||
$component = Yii::$app->user;
|
$component = Yii::$app->user;
|
||||||
try {
|
try {
|
||||||
$token = $component->parseToken($rawToken);
|
$token = $component->parseToken($rawToken);
|
||||||
} catch (ExpiredException $e) {
|
} catch (ExpiredException | InvalidSubjectException $e) {
|
||||||
|
// InvalidSubjectException is temporary solution and should be removed in the next release
|
||||||
throw new UnauthorizedHttpException('Token expired');
|
throw new UnauthorizedHttpException('Token expired');
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Yii::error($e);
|
Yii::error($e);
|
||||||
|
Loading…
Reference in New Issue
Block a user