Skip to content
This repository was archived by the owner on Aug 31, 2026. It is now read-only.

Commit 8e5c0b1

Browse files
committed
remove redundant JWT validation introduced in #5535
1 parent eebfdbc commit 8e5c0b1

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

‎http/auth.go‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,12 @@ func withUser(fn handleFunc) handleFunc {
8686
}
8787

8888
var tk authToken
89-
p := jwt.NewParser(jwt.WithValidMethods([]string{jwt.SigningMethodHS256.Alg()}))
89+
p := jwt.NewParser(jwt.WithValidMethods([]string{jwt.SigningMethodHS256.Alg()}), jwt.WithExpirationRequired())
9090
token, err := request.ParseFromRequest(r, &extractor{}, keyFunc, request.WithClaims(&tk), request.WithParser(p))
9191
if (err != nil || !token.Valid) && !renewableErr(err, d) {
9292
return http.StatusUnauthorized, nil
9393
}
9494

95-
err = jwt.NewValidator(jwt.WithExpirationRequired()).Validate(tk)
96-
if err != nil {
97-
return http.StatusUnauthorized, nil
98-
}
99-
10095
expiresSoon := tk.ExpiresAt != nil && time.Until(tk.ExpiresAt.Time) < time.Hour
10196
updated := tk.IssuedAt != nil && tk.IssuedAt.Unix() < d.store.Users.LastUpdate(tk.User.ID)
10297

0 commit comments

Comments
 (0)