mirror of
				https://github.com/elyby/accounts.git
				synced 2025-05-31 14:11:46 +05:30 
			
		
		
		
	Не логгируем InvalidSubjectException, возникающий из-за перехода на новый формат токенов
This commit is contained in:
		@@ -4,6 +4,7 @@ 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;
 | 
			
		||||
@@ -28,7 +29,8 @@ class JwtIdentity implements IdentityInterface {
 | 
			
		||||
        $component = Yii::$app->user;
 | 
			
		||||
        try {
 | 
			
		||||
            $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');
 | 
			
		||||
        } catch (Exception $e) {
 | 
			
		||||
            Yii::error($e);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user