fix: 'tokenInfo' might have 'nil' or bad value (#1534)

* fix: 'tokenInfo' might have 'nil' or bad value

* fix: return the origin err
pull/1535/head
Bear 3 years ago committed by GitHub
parent 0597883e70
commit 5e88a20cd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      middleware/auth/jwt/jwt.go

@ -93,6 +93,7 @@ func Server(keyFunc jwt.Keyfunc, opts ...Option) middleware.Middleware {
return nil, ErrTokenParseFail return nil, ErrTokenParseFail
} }
} }
return nil, errors.Unauthorized("UNAUTHORIZED", err.Error())
} else if !tokenInfo.Valid { } else if !tokenInfo.Valid {
return nil, ErrTokenInvalid return nil, ErrTokenInvalid
} else if tokenInfo.Method != o.signingMethod { } else if tokenInfo.Method != o.signingMethod {

Loading…
Cancel
Save