Skip to content

Commit 5fcf514

Browse files
committed
chore: use community maintained golang-jwt
The dgrijalva/jwt-go project is no longer maintained[1] and they have transferred ownership to golang-jwt/jwt[2][3][4]. We should move to the supported golang-jwt/jwt. The following was performed: 1. update services/httpd/handler*.go to import golang-jwt/jwt 2. revert testcase string comparison changes from 225bcec (back to v3) 2. go mod edit -require github.com/golang-jwt/[email protected]+incompatible 3. go mod edit -droprequire github.com/dgrijalva/jwt-go 4. go mod tidy 5. go clean ./... && go build ./... 6. go test ./... References: [1] dgrijalva/jwt-go#462 [2] dgrijalva/jwt-go#463 [3] https://github.com/dgrijalva/jwt-go/blob/master/README.md [4] https://github.com/golang-jwt/jwt [5] influxdata#21926
1 parent d28bcb8 commit 5fcf514

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

DEPENDENCIES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
- github.com/cespare/xxhash [MIT LICENSE](https://github.com/cespare/xxhash/blob/master/LICENSE.txt)
1010
- github.com/clarkduvall/hyperloglog [MIT LICENSE](https://github.com/clarkduvall/hyperloglog/blob/master/LICENSE)
1111
- github.com/davecgh/go-spew/spew [ISC LICENSE](https://github.com/davecgh/go-spew/blob/master/LICENSE)
12-
- github.com/dgrijalva/jwt-go [MIT LICENSE](https://github.com/dgrijalva/jwt-go/blob/master/LICENSE)
1312
- github.com/dgryski/go-bits [MIT LICENSE](https://github.com/dgryski/go-bits/blob/master/LICENSE)
1413
- github.com/dgryski/go-bitstream [MIT LICENSE](https://github.com/dgryski/go-bitstream/blob/master/LICENSE)
1514
- github.com/glycerine/go-unsnap-stream [MIT LICENSE](https://github.com/glycerine/go-unsnap-stream/blob/master/LICENSE)
1615
- github.com/gogo/protobuf/proto [BSD LICENSE](https://github.com/gogo/protobuf/blob/master/LICENSE)
16+
- github.com/golang-jwt/jwt [MIT LICENSE](https://github.com/golang-jwt/jwt/blob/master/LICENSE)
1717
- github.com/golang/protobuf [BSD LICENSE](https://github.com/golang/protobuf/blob/master/LICENSE)
1818
- github.com/golang/snappy [BSD LICENSE](https://github.com/golang/snappy/blob/master/LICENSE)
1919
- github.com/google/go-cmp [BSD LICENSE](https://github.com/google/go-cmp/blob/master/LICENSE)

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ require (
1010
github.com/boltdb/bolt v1.3.1
1111
github.com/cespare/xxhash v1.1.0
1212
github.com/davecgh/go-spew v1.1.1
13-
github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1
1413
github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8
1514
github.com/gogo/protobuf v1.3.1
15+
github.com/golang-jwt/jwt v3.2.1+incompatible
1616
github.com/golang/snappy v0.0.1
1717
github.com/google/go-cmp v0.5.0
1818
github.com/influxdata/flux v0.65.0

go.sum

+2-3
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,7 @@ github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhr
131131
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
132132
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
133133
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
134-
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
135134
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
136-
github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1 h1:CaO/zOnF8VvUfEbhRatPcwKVWamvbYd8tQGRWacE9kU=
137-
github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1/go.mod h1:+hnT3ywWDTAFrW5aE+u2Sa/wT555ZqwoCS+pk3p6ry4=
138135
github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8 h1:akOQj8IVgoeFfBTzGOEQakCYshWD6RNo1M5pivFXt70=
139136
github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ=
140137
github.com/dgryski/go-sip13 v0.0.0-20190329191031-25c5027a8c7b/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
@@ -276,6 +273,8 @@ github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5
276273
github.com/gogo/protobuf v1.2.2-0.20190730201129-28a6bbf47e48/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
277274
github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls=
278275
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
276+
github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c=
277+
github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
279278
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
280279
github.com/golang/geo v0.0.0-20190916061304-5b978397cfec h1:lJwO/92dFXWeXOZdoGXgptLmNLwynMSHUmU6besqtiw=
281280
github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=

services/httpd/handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import (
2323
httppprof "net/http/pprof"
2424

2525
"github.com/bmizerany/pat"
26-
"github.com/dgrijalva/jwt-go/v4"
2726
"github.com/gogo/protobuf/proto"
27+
"github.com/golang-jwt/jwt"
2828
"github.com/golang/snappy"
2929
"github.com/influxdata/flux"
3030
"github.com/influxdata/flux/lang"

services/httpd/handler_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import (
2121
"testing"
2222
"time"
2323

24-
"github.com/dgrijalva/jwt-go/v4"
2524
"github.com/gogo/protobuf/proto"
25+
"github.com/golang-jwt/jwt"
2626
"github.com/golang/snappy"
2727
"github.com/google/go-cmp/cmp"
2828
"github.com/influxdata/flux"
@@ -196,7 +196,7 @@ func TestHandler_Query_Auth(t *testing.T) {
196196
h.ServeHTTP(w, req)
197197
if w.Code != http.StatusUnauthorized {
198198
t.Fatalf("unexpected status: %d: %s", w.Code, w.Body.String())
199-
} else if body := strings.TrimSpace(w.Body.String()); body != `{"error":"token signature is invalid"}` {
199+
} else if body := strings.TrimSpace(w.Body.String()); body != `{"error":"signature is invalid"}` {
200200
t.Fatalf("unexpected body: %s", body)
201201
}
202202

@@ -220,7 +220,7 @@ func TestHandler_Query_Auth(t *testing.T) {
220220
h.ServeHTTP(w, req)
221221
if w.Code != http.StatusUnauthorized {
222222
t.Fatalf("unexpected status: %d: %s", w.Code, w.Body.String())
223-
} else if !strings.Contains(w.Body.String(), `{"error":"token is expired`) {
223+
} else if !strings.Contains(w.Body.String(), `{"error":"Token is expired`) {
224224
t.Fatalf("unexpected body: %s", w.Body.String())
225225
}
226226

0 commit comments

Comments
 (0)