From 25730d8eeb09c31ec1ea1f2c17efe85c10d2fad6 Mon Sep 17 00:00:00 2001 From: rchowinfoblox Date: Mon, 2 May 2022 17:07:13 -0700 Subject: [PATCH] Migrate to golang-jwt/jwt/v4 --- auth/interceptor_test.go | 2 +- auth/jwt.go | 4 ++-- auth/jwt_test.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- integration/grpc.go | 2 +- integration/grpc_test.go | 2 +- integration/jwt.go | 2 +- integration/jwt_test.go | 2 +- logging/gateway_interceptor.go | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/auth/interceptor_test.go b/auth/interceptor_test.go index 96968f19..28b928d1 100644 --- a/auth/interceptor_test.go +++ b/auth/interceptor_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/dgrijalva/jwt-go" + "github.com/golang-jwt/jwt/v4" grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" grpc_logrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus" "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus" diff --git a/auth/jwt.go b/auth/jwt.go index eaec8c76..b85fd975 100644 --- a/auth/jwt.go +++ b/auth/jwt.go @@ -5,7 +5,7 @@ import ( "errors" "fmt" - jwt "github.com/dgrijalva/jwt-go" + jwt "github.com/golang-jwt/jwt/v4" "github.com/grpc-ecosystem/go-grpc-middleware/auth" ) @@ -71,7 +71,7 @@ func GetAccountID(ctx context.Context, keyfunc jwt.Keyfunc) (string, error) { // getToken parses the token into a jwt.Token type from the grpc metadata. // WARNING: if keyfunc is nil, the token will get parsed but not verified // because it has been checked previously in the stack. More information -// here: https://godoc.org/github.com/dgrijalva/jwt-go#Parser.ParseUnverified +// here: https://pkg.go.dev/github.com/golang-jwt/jwt/v4#Parser.ParseUnverified func getToken(ctx context.Context, tokenField string, keyfunc jwt.Keyfunc) (jwt.Token, error) { if ctx == nil { return jwt.Token{}, errMissingToken diff --git a/auth/jwt_test.go b/auth/jwt_test.go index 66cb9ae4..c860ef6c 100644 --- a/auth/jwt_test.go +++ b/auth/jwt_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - jwt "github.com/dgrijalva/jwt-go" + jwt "github.com/golang-jwt/jwt/v4" "google.golang.org/grpc/metadata" ) diff --git a/go.mod b/go.mod index 973932f4..819c4f3e 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.14 require ( contrib.go.opencensus.io/exporter/ocagent v0.7.0 github.com/DATA-DOG/go-sqlmock v1.5.0 - github.com/dgrijalva/jwt-go v3.2.1-0.20200107013213-dc14462fd587+incompatible + github.com/golang-jwt/jwt/v4 v4.4.1 github.com/golang/protobuf v1.5.2 github.com/google/uuid v1.2.0 github.com/gorilla/mux v1.8.0 diff --git a/go.sum b/go.sum index 3bcb76cf..0b39e76d 100644 --- a/go.sum +++ b/go.sum @@ -54,8 +54,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd h1:83Wprp6ROGeiHFAP8WJdI2RoxALQYgdllERc3N5N2DM= github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= -github.com/dgrijalva/jwt-go v3.2.1-0.20200107013213-dc14462fd587+incompatible h1:CiQ/hJK0Lsc/2Gm9uMSIe7cFE+h0sbTwHuTGQkIZpio= -github.com/dgrijalva/jwt-go v3.2.1-0.20200107013213-dc14462fd587+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -75,6 +73,8 @@ github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang-jwt/jwt/v4 v4.4.1 h1:pC5DB52sCeK48Wlb9oPcdhnjkz1TKt1D/P7WKJ0kUcQ= +github.com/golang-jwt/jwt/v4 v4.4.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= diff --git a/integration/grpc.go b/integration/grpc.go index e7be2d84..419e15d1 100644 --- a/integration/grpc.go +++ b/integration/grpc.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - jwt "github.com/dgrijalva/jwt-go" + jwt "github.com/golang-jwt/jwt/v4" "google.golang.org/grpc/metadata" "github.com/infobloxopen/atlas-app-toolkit/auth" diff --git a/integration/grpc_test.go b/integration/grpc_test.go index cb500661..599f76f4 100644 --- a/integration/grpc_test.go +++ b/integration/grpc_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - jwt "github.com/dgrijalva/jwt-go" + jwt "github.com/golang-jwt/jwt/v4" "github.com/infobloxopen/atlas-app-toolkit/auth" "google.golang.org/grpc/metadata" ) diff --git a/integration/jwt.go b/integration/jwt.go index b630d525..8e0a8a22 100644 --- a/integration/jwt.go +++ b/integration/jwt.go @@ -1,7 +1,7 @@ package integration import ( - jwt "github.com/dgrijalva/jwt-go" + jwt "github.com/golang-jwt/jwt/v4" "github.com/infobloxopen/atlas-app-toolkit/auth" ) diff --git a/integration/jwt_test.go b/integration/jwt_test.go index d344fb06..4d9735b6 100644 --- a/integration/jwt_test.go +++ b/integration/jwt_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - jwt "github.com/dgrijalva/jwt-go" + jwt "github.com/golang-jwt/jwt/v4" ) var ( diff --git a/logging/gateway_interceptor.go b/logging/gateway_interceptor.go index a7f7e8f0..036c96a2 100644 --- a/logging/gateway_interceptor.go +++ b/logging/gateway_interceptor.go @@ -5,7 +5,7 @@ import ( "path" "time" - jwt "github.com/dgrijalva/jwt-go" + jwt "github.com/golang-jwt/jwt/v4" "github.com/google/uuid" grpc_logrus "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus" "github.com/grpc-ecosystem/go-grpc-middleware/logging/logrus/ctxlogrus"