Больше не игнорируем JWT InvalidSubjectException

UnauthorizedHttpException в User/Component больше не логгируется
This commit is contained in:
ErickSkrauch
2017-12-02 21:04:48 +03:00
parent 868ee1c61c
commit 9356ad24b3
3 changed files with 19 additions and 10 deletions

View File

@@ -4,7 +4,6 @@ namespace api\components\User;
use common\models\Account;
use Emarref\Jwt\Claim\Subject;
use Emarref\Jwt\Exception\ExpiredException;
use Emarref\Jwt\Exception\InvalidSubjectException;
use Emarref\Jwt\Token;
use Exception;
use Yii;
@@ -29,8 +28,7 @@ class JwtIdentity implements IdentityInterface {
$component = Yii::$app->user;
try {
$token = $component->parseToken($rawToken);
} catch (ExpiredException | InvalidSubjectException $e) {
// InvalidSubjectException is temporary solution and should be removed in the next release
} catch (ExpiredException $e) {
throw new UnauthorizedHttpException('Token expired');
} catch (Exception $e) {
Yii::error($e);