Skip to content

Commit f2d12ee

Browse files
committed
fixing issue with optional mode in request parser
1 parent dbaac3e commit f2d12ee

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

internal/jwt/validator.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ func (v *Validator) ParseHTTPRequest(r *http.Request) (accessToken jwt.Token, re
186186
case errors.Is(err, jwt.ErrInvalidIssuer()):
187187
return nil, &ErrJWTInvalidIssuer
188188
case jws.IsVerificationError(err):
189+
if v.IsOptional() {
190+
return nil, nil
191+
}
189192
panic("unable to verify jwt")
190193
case errors.Is(err, jwt.ErrInvalidJWT()):
191194
res := ErrJWTMalformed

0 commit comments

Comments
 (0)