diff --git a/README.md b/README.md index f660fad..8463c61 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ # keyfunc Purpose of this package is to provide a -[`jwt.Keyfunc`](https://pkg.go.dev/github.com/golang-jwt/jwt#Keyfunc) for the -[github.com/golang-jwt/jwt](https://github.com/golang-jwt/jwt) package and its popular forks using a JSON Web Key Set +[`jwt.Keyfunc`](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#Keyfunc) for the +[github.com/golang-jwt/jwt/v4](https://github.com/golang-jwt/jwt/v4) package and its popular forks using a JSON Web Key Set (JWKs) for parsing and verifying JSON Web Tokens (JWTs). This was [formally](https://github.com/dgrijalva/jwt-go/issues/462) the [github.com/dgrijalva/jwt-go](https://github.com/dgrijalva/jwt-go) package. @@ -12,11 +12,11 @@ the [github.com/dgrijalva/jwt-go](https://github.com/dgrijalva/jwt-go) package. It's common for an identity provider, such as [Keycloak](https://www.keycloak.org/) or [Amazon Cognito (AWS)](https://aws.amazon.com/cognito/) to expose a JWKs via an HTTPS endpoint. This package has the ability to consume that JWKs and produce a -[`jwt.Keyfunc`](https://pkg.go.dev/github.com/golang-jwt/jwt#Keyfunc). It is important that a JWKs +[`jwt.Keyfunc`](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#Keyfunc). It is important that a JWKs endpoint is using HTTPS to ensure the keys are from the correct trusted source. This repository has the following dependencies: -* [github.com/golang-jwt/jwt](https://github.com/golang-jwt/jwt) +* [github.com/golang-jwt/jwt/v4](https://github.com/golang-jwt/jwt/v4) * [github.com/dgrijalva/jwt-go](https://github.com/dgrijalva/jwt-go) * [github.com/form3tech-oss/jwt-go](https://github.com/form3tech-oss/jwt-go) @@ -95,7 +95,7 @@ Additional options can be passed to the [`keyfunc.Get`](https://pkg.go.dev/githu via variadic arguments. See [`keyfunc.Options`](https://pkg.go.dev/github.com/MicahParks/keyfunc#Options) and the additional features mentioned at the bottom of this `README.md`. -### Step 2: Use the [`keyfunc.JWKs`](https://pkg.go.dev/github.com/MicahParks/keyfunc#JWKs) 's [`JWKs.KeyFunc`](https://pkg.go.dev/github.com/MicahParks/keyfunc#JWKs.KeyFunc) method as the [`jwt.Keyfunc`](https://pkg.go.dev/github.com/golang-jwt/jwt#Keyfunc) when parsing tokens +### Step 2: Use the [`keyfunc.JWKs`](https://pkg.go.dev/github.com/MicahParks/keyfunc#JWKs) 's [`JWKs.KeyFunc`](https://pkg.go.dev/github.com/MicahParks/keyfunc#JWKs.KeyFunc) method as the [`jwt.Keyfunc`](https://pkg.go.dev/github.com/golang-jwt/jwt/v4#Keyfunc) when parsing tokens ```go // Parse the JWT. @@ -110,7 +110,7 @@ key with the matching `kid` (if present) and return its public key as the correc ## Fork support -Some packages use forks of [github.com/golang-jwt/jwt](https://github.com/golang-jwt/jwt). This package aims to support +Some packages use forks of [github.com/golang-jwt/jwt/v4](https://github.com/golang-jwt/jwt/v4). This package aims to support the most popular use cases of these forks. If additional forks are required for your use case, please feel free to open an issue or PR. @@ -143,7 +143,7 @@ jwtMiddleware := jwtmiddleware.New(jwtmiddleware.Options{ This project originally only supported [github.com/dgrijalva/jwt-go](https://github.com/dgrijalva/jwt-go), but since it is no longer maintained, it's method was moved to [`JWKs.KeyFuncLegacy`](https://pkg.go.dev/github.com/MicahParks/keyfunc#JWKs.KeyFuncLegacy) if you have not moved to -[github.com/golang-jwt/jwt](https://github.com/golang-jwt/jwt) yet. +[github.com/golang-jwt/jwt/v4](https://github.com/golang-jwt/jwt/v4) yet. ## Test coverage diff --git a/examples/auth0middleware/go.mod b/examples/auth0middleware/go.mod index 58d9268..9c94189 100644 --- a/examples/auth0middleware/go.mod +++ b/examples/auth0middleware/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/MicahParks/keyfunc v0.6.1 github.com/auth0/go-jwt-middleware v1.0.1 - github.com/form3tech-oss/jwt-go v3.2.3+incompatible + github.com/form3tech-oss/jwt-go v3.2.5+incompatible ) replace github.com/MicahParks/keyfunc => ../../ diff --git a/examples/auth0middleware/go.sum b/examples/auth0middleware/go.sum index 7fca0ba..9f0a263 100644 --- a/examples/auth0middleware/go.sum +++ b/examples/auth0middleware/go.sum @@ -3,10 +3,10 @@ github.com/auth0/go-jwt-middleware v1.0.1/go.mod h1:YSeUX3z6+TF2H+7padiEqNJ73Zy9 github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= -github.com/form3tech-oss/jwt-go v3.2.3+incompatible h1:7ZaBxOI7TMoYBfyA3cQHErNNyAWIKUMIwqxEtgHOs5c= -github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= -github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= -github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/form3tech-oss/jwt-go v3.2.5+incompatible h1:/l4kBbb4/vGSsdtB5nUe8L7B9mImVMaBPw9L/0TBHU8= +github.com/form3tech-oss/jwt-go v3.2.5+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= +github.com/golang-jwt/jwt/v4 v4.0.0 h1:RAqyYixv1p7uEnocuy8P1nru5wprCh/MH2BIlW5z5/o= +github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 h1:l5lAOZEym3oK3SQ2HBHWsJUfbNBiTXJDeW2QDxw9AQ0= github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= diff --git a/examples/aws_cognito/main.go b/examples/aws_cognito/main.go index 7844d09..7e312c3 100644 --- a/examples/aws_cognito/main.go +++ b/examples/aws_cognito/main.go @@ -5,7 +5,7 @@ import ( "log" "time" - "github.com/golang-jwt/jwt" + "github.com/golang-jwt/jwt/v4" "github.com/MicahParks/keyfunc" ) diff --git a/examples/ctx/main.go b/examples/ctx/main.go index d2d0a38..9d7ce4d 100644 --- a/examples/ctx/main.go +++ b/examples/ctx/main.go @@ -4,7 +4,7 @@ import ( "log" "time" - "github.com/golang-jwt/jwt" + "github.com/golang-jwt/jwt/v4" "github.com/MicahParks/keyfunc" ) diff --git a/examples/interval/main.go b/examples/interval/main.go index 5d93f10..1105102 100644 --- a/examples/interval/main.go +++ b/examples/interval/main.go @@ -4,7 +4,7 @@ import ( "log" "time" - "github.com/golang-jwt/jwt" + "github.com/golang-jwt/jwt/v4" "github.com/MicahParks/keyfunc" ) diff --git a/examples/json/main.go b/examples/json/main.go index 4f73534..73f9a79 100644 --- a/examples/json/main.go +++ b/examples/json/main.go @@ -4,7 +4,7 @@ import ( "encoding/json" "log" - "github.com/golang-jwt/jwt" + "github.com/golang-jwt/jwt/v4" "github.com/MicahParks/keyfunc" ) diff --git a/examples/keycloak/main.go b/examples/keycloak/main.go index 5a50c59..5828cf2 100644 --- a/examples/keycloak/main.go +++ b/examples/keycloak/main.go @@ -3,7 +3,7 @@ package main import ( "log" - "github.com/golang-jwt/jwt" + "github.com/golang-jwt/jwt/v4" "github.com/MicahParks/keyfunc" ) diff --git a/examples/recommended_options/main.go b/examples/recommended_options/main.go index 3c104c4..560d0ac 100644 --- a/examples/recommended_options/main.go +++ b/examples/recommended_options/main.go @@ -4,7 +4,7 @@ import ( "log" "time" - "github.com/golang-jwt/jwt" + "github.com/golang-jwt/jwt/v4" "github.com/MicahParks/keyfunc" ) diff --git a/go.mod b/go.mod index fc654d1..794f6e4 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,6 @@ go 1.13 require ( github.com/dgrijalva/jwt-go v3.2.0+incompatible - github.com/form3tech-oss/jwt-go v3.2.3+incompatible - github.com/golang-jwt/jwt v3.2.2+incompatible + github.com/form3tech-oss/jwt-go v3.2.5+incompatible + github.com/golang-jwt/jwt/v4 v4.0.0 ) diff --git a/go.sum b/go.sum index 56dd2dd..f643b13 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/form3tech-oss/jwt-go v3.2.3+incompatible h1:7ZaBxOI7TMoYBfyA3cQHErNNyAWIKUMIwqxEtgHOs5c= -github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= -github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= -github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/form3tech-oss/jwt-go v3.2.5+incompatible h1:/l4kBbb4/vGSsdtB5nUe8L7B9mImVMaBPw9L/0TBHU8= +github.com/form3tech-oss/jwt-go v3.2.5+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= +github.com/golang-jwt/jwt/v4 v4.0.0 h1:RAqyYixv1p7uEnocuy8P1nru5wprCh/MH2BIlW5z5/o= +github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= diff --git a/jwks_test.go b/jwks_test.go index e82c96c..f638795 100644 --- a/jwks_test.go +++ b/jwks_test.go @@ -12,7 +12,7 @@ import ( "testing" "time" - "github.com/golang-jwt/jwt" + "github.com/golang-jwt/jwt/v4" "github.com/MicahParks/keyfunc" ) diff --git a/keyfunc.go b/keyfunc.go index b50f84a..d3cfa41 100644 --- a/keyfunc.go +++ b/keyfunc.go @@ -6,7 +6,7 @@ import ( legacy "github.com/dgrijalva/jwt-go" f3t "github.com/form3tech-oss/jwt-go" - "github.com/golang-jwt/jwt" + "github.com/golang-jwt/jwt/v4" ) var (