Fixes ACCOUNTS-2. Catch decryption exception for OAuth2 flow

This commit is contained in:
ErickSkrauch
2020-08-23 00:23:36 +03:00
parent 503880615a
commit 2a4f29801d
3 changed files with 21 additions and 6 deletions

View File

@@ -6,12 +6,9 @@ namespace api\components\Tokens;
use Lcobucci\JWT\Token;
use Yii;
class TokenReader {
final class TokenReader {
/**
* @var Token
*/
private $token;
private Token $token;
public function __construct(Token $token) {
$this->token = $token;
@@ -55,6 +52,10 @@ class TokenReader {
return null;
}
/**
* It really might throw an exception but we have not seen any case of such exception yet
* @noinspection PhpUnhandledExceptionInspection
*/
return Yii::$app->tokens->decryptValue($encodedClientToken);
}