diff --git a/http/auth.go b/http/auth.go index 8174938d..9c51a409 100644 --- a/http/auth.go +++ b/http/auth.go @@ -86,17 +86,12 @@ func withUser(fn handleFunc) handleFunc { } var tk authToken - p := jwt.NewParser(jwt.WithValidMethods([]string{jwt.SigningMethodHS256.Alg()})) + p := jwt.NewParser(jwt.WithValidMethods([]string{jwt.SigningMethodHS256.Alg()}), jwt.WithExpirationRequired()) token, err := request.ParseFromRequest(r, &extractor{}, keyFunc, request.WithClaims(&tk), request.WithParser(p)) if (err != nil || !token.Valid) && !renewableErr(err, d) { return http.StatusUnauthorized, nil } - err = jwt.NewValidator(jwt.WithExpirationRequired()).Validate(tk) - if err != nil { - return http.StatusUnauthorized, nil - } - expiresSoon := tk.ExpiresAt != nil && time.Until(tk.ExpiresAt.Time) < time.Hour updated := tk.IssuedAt != nil && tk.IssuedAt.Unix() < d.store.Users.LastUpdate(tk.User.ID)