Skip to content

Commit

Permalink
Merge pull request #318 from rchowinfoblox/golang-jwt-v4
Browse files Browse the repository at this point in the history
Migrate to golang-jwt/jwt/v4
  • Loading branch information
rchowinfoblox authored May 3, 2022
2 parents 21154ed + 25730d8 commit c87e650
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion auth/interceptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions auth/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion auth/jwt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand All @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion integration/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion integration/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion integration/jwt.go
Original file line number Diff line number Diff line change
@@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion integration/jwt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"testing"

jwt "github.com/dgrijalva/jwt-go"
jwt "github.com/golang-jwt/jwt/v4"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion logging/gateway_interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit c87e650

Please sign in to comment.