feat(jwt): handle nil keyset

This commit is contained in:
wpetit 2023-03-28 20:38:29 +02:00
parent 1996f4dc56
commit d8ce2901d2
1 changed files with 4 additions and 0 deletions

View File

@ -61,6 +61,10 @@ func FindToken(r *http.Request, getKeySet GetKeySetFunc) (jwt.Token, error) {
return nil, errors.WithStack(err) return nil, errors.WithStack(err)
} }
if keySet == nil {
return nil, errors.New("no keyset")
}
token, err := jwt.Parse([]byte(rawToken), token, err := jwt.Parse([]byte(rawToken),
jwt.WithKeySet(keySet, jws.WithRequireKid(false)), jwt.WithKeySet(keySet, jws.WithRequireKid(false)),
jwt.WithValidate(true), jwt.WithValidate(true),