|
|
@@ -22,7 +22,8 @@ class AuthHook
|
|
|
#[Hook("token_verify")]
|
|
|
public function checkToken($payload): void
|
|
|
{
|
|
|
- if ($this->cache->has(self::TOKEN_REVOKE . $payload->jti)) {
|
|
|
+ if ($this->cache->has(self::TOKEN_REVOKE . $payload->jti)
|
|
|
+ && $this->cache->get(self::TOKEN_REVOKE . $payload->jti) < time() + Auth::SLEEP_WAY) {
|
|
|
throw new \Exception('token 已失效');
|
|
|
}
|
|
|
}
|
|
|
@@ -30,6 +31,6 @@ class AuthHook
|
|
|
#[Hook("token_revoke")]
|
|
|
public function revokeToken($payload): void
|
|
|
{
|
|
|
- $this->cache->remember(self::TOKEN_REVOKE . $payload->jti, 1, $payload->exp - time() + Auth::SLEEP_WAY);
|
|
|
+ $this->cache->remember(self::TOKEN_REVOKE . $payload->jti, time(), $payload->exp - time() + Auth::SLEEP_WAY);
|
|
|
}
|
|
|
}
|