Skip to content

Commit 8a41c62

Browse files
committed
JWT middleware has been changed from github.com/dgrijalva/jwt-go to github.com/golang-jwt/jwt` due former library being unmaintained and having security
issues. For detailed information please read #1940
1 parent 58366f9 commit 8a41c62

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/labstack/echo/v4
33
go 1.15
44

55
require (
6-
github.com/dgrijalva/jwt-go v3.2.0+incompatible
6+
github.com/golang-jwt/jwt v3.2.2+incompatible
77
github.com/labstack/gommon v0.3.0
88
github.com/mattn/go-colorable v0.1.8 // indirect
99
github.com/stretchr/testify v1.4.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
22
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3-
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
4-
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
3+
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
4+
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
55
github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0=
66
github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
77
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=

middleware/jwt.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"reflect"
88
"strings"
99

10-
"github.com/dgrijalva/jwt-go"
10+
"github.com/golang-jwt/jwt"
1111
"github.com/labstack/echo/v4"
1212
)
1313

@@ -88,7 +88,7 @@ type (
8888

8989
// ParseTokenFunc defines a user-defined function that parses token from given auth. Returns an error when token
9090
// parsing fails or parsed token is invalid.
91-
// Defaults to implementation using `github.com/dgrijalva/jwt-go` as JWT implementation library
91+
// Defaults to implementation using `github.com/golang-jwt/jwt` as JWT implementation library
9292
ParseTokenFunc func(auth string, c echo.Context) (interface{}, error)
9393
}
9494

middleware/jwt_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"strings"
1010
"testing"
1111

12-
"github.com/dgrijalva/jwt-go"
12+
"github.com/golang-jwt/jwt"
1313
"github.com/labstack/echo/v4"
1414
"github.com/stretchr/testify/assert"
1515
)
@@ -562,7 +562,7 @@ func TestJWTConfig_custom_ParseTokenFunc_Keyfunc(t *testing.T) {
562562
return c.String(http.StatusTeapot, "test")
563563
})
564564

565-
// example of minimal custom ParseTokenFunc implementation. Allows you to use different versions of `github.com/dgrijalva/jwt-go`
565+
// example of minimal custom ParseTokenFunc implementation. Allows you to use different versions of `github.com/golang-jwt/jwt`
566566
// with current JWT middleware
567567
signingKey := []byte("secret")
568568

0 commit comments

Comments
 (0)