From aed172b8ddd31368e27803b06197e32133ce43b9 Mon Sep 17 00:00:00 2001 From: Bin <49082129+songzhibin97@users.noreply.github.com> Date: Thu, 4 May 2023 17:15:36 +0800 Subject: [PATCH] feat: jwt KeyFunc external return (#2809) * Update jwt.go * Update jwt.go --- middleware/auth/jwt/jwt.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/middleware/auth/jwt/jwt.go b/middleware/auth/jwt/jwt.go index 2c65c209c..c83d5cddd 100644 --- a/middleware/auth/jwt/jwt.go +++ b/middleware/auth/jwt/jwt.go @@ -114,6 +114,9 @@ func Server(keyFunc jwt.Keyfunc, opts ...Option) middleware.Middleware { if ve.Errors&(jwt.ValidationErrorExpired|jwt.ValidationErrorNotValidYet) != 0 { return nil, ErrTokenExpired } + if ve.Inner != nil { + return nil, ve.Inner + } return nil, ErrTokenParseFail } if !tokenInfo.Valid {