|
@@ -53,9 +53,11 @@ class Auth implements AuthInterface
|
|
|
JWT::$leeway = self::SLEEP_WAY;
|
|
JWT::$leeway = self::SLEEP_WAY;
|
|
|
try {
|
|
try {
|
|
|
$payload = JWT::decode($jwt, new Key($this->config['jwt_secret'], self::ALGORITHM));
|
|
$payload = JWT::decode($jwt, new Key($this->config['jwt_secret'], self::ALGORITHM));
|
|
|
- } catch (ExpiredException) {
|
|
|
|
|
|
|
+ } catch (ExpiredException $e) {
|
|
|
// ... 忽略
|
|
// ... 忽略
|
|
|
|
|
+ $payload = $e->getPayload();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
$res = match (UserTypeEnum::tryFrom($payload->aud)) {
|
|
$res = match (UserTypeEnum::tryFrom($payload->aud)) {
|
|
|
$this->userType => decrypt_data($payload->sub, $this->config['jwt_secret']),
|
|
$this->userType => decrypt_data($payload->sub, $this->config['jwt_secret']),
|
|
|
default => throw new \Exception('token 类型错误'),
|
|
default => throw new \Exception('token 类型错误'),
|