mirror of
https://gitee.com/ctexthuang/hyperf_rbac_framework_server_ctexthuang.git
synced 2026-03-26 19:50:17 +08:00
feat : jwt
This commit is contained in:
@@ -9,6 +9,7 @@ use App\Exception\ErrException;
|
||||
use App\Interface\JwtInterface;
|
||||
use Lcobucci\JWT\Token\RegisteredClaims;
|
||||
use Lcobucci\JWT\UnencryptedToken;
|
||||
use Lcobucci\JWT\Validation\RequiredConstraintsViolated;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
@@ -49,7 +50,11 @@ class RefreshAdminTokenMiddleware extends AbstractTokenMiddleware
|
||||
*/
|
||||
protected function parserToken(ServerRequestInterface $request): UnencryptedToken
|
||||
{
|
||||
return $this->getJwt()->parserRefreshToken($this->getToken($request));
|
||||
try {
|
||||
return $this->getJwt()->parserRefreshToken($this->getToken($request));
|
||||
} catch (RequiredConstraintsViolated $e) {
|
||||
throw new ErrException('token过期',ResultCode::JWT_EXPIRED,['err_msg' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user