Skip to content

Commit 0945275

Browse files
grounded042sergiught
authored andcommitted
use github.com/pkg/errors (#98)
1 parent bd285b3 commit 0945275

File tree

11 files changed

+12
-12
lines changed

11 files changed

+12
-12
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ go 1.14
55
require (
66
github.com/golang-jwt/jwt v3.2.1+incompatible
77
github.com/google/go-cmp v0.5.6
8+
github.com/pkg/errors v0.9.1
89
github.com/stretchr/testify v1.7.0 // indirect
910
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
1011
gopkg.in/square/go-jose.v2 v2.5.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ 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=
33
github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c=
44
github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
5-
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
6-
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
75
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
86
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
7+
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
8+
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
99
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1010
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1111
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

jwtmiddleware.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package jwtmiddleware
22

33
import (
44
"context"
5-
"errors"
65
"fmt"
76
"net/http"
87
"strings"
8+
9+
"github.com/pkg/errors"
910
)
1011

1112
var (

jwtmiddleware_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package jwtmiddleware
22

33
import (
44
"context"
5-
"errors"
65
"fmt"
76
"io/ioutil"
87
"net/http"
@@ -12,6 +11,7 @@ import (
1211

1312
"github.com/auth0/go-jwt-middleware/validate/josev2"
1413
"github.com/google/go-cmp/cmp"
14+
"github.com/pkg/errors"
1515
"gopkg.in/square/go-jose.v2"
1616
"gopkg.in/square/go-jose.v2/jwt"
1717
)

validate/josev2/doc.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ the Square go-jose package version 2.
44
55
The implementation handles some nuances around JWTs and supports:
66
- a key func to pull the key(s) used to verify the token signature
7-
// TODO(joncarl): maybe we should provide a high level helper func for the above
87
- verifying the signature algorithm is what it should be
98
- validation of "regular" claims
109
- validation of custom claims

validate/josev2/examples/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ package main
33
import (
44
"context"
55
"encoding/json"
6-
"errors"
76
"fmt"
87
"net/http"
98
"time"
109

1110
jwtmiddleware "github.com/auth0/go-jwt-middleware"
1211
"github.com/auth0/go-jwt-middleware/validate/josev2"
12+
"github.com/pkg/errors"
1313
"gopkg.in/square/go-jose.v2"
1414
"gopkg.in/square/go-jose.v2/jwt"
1515
)

validate/josev2/josev2.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ package josev2
33
import (
44
"context"
55
"encoding/json"
6-
"errors"
76
"fmt"
87
"net/http"
98
"net/url"
109
"sync"
1110
"time"
1211

1312
"github.com/auth0/go-jwt-middleware/internal/oidc"
13+
"github.com/pkg/errors"
1414
"gopkg.in/square/go-jose.v2"
1515
"gopkg.in/square/go-jose.v2/jwt"
1616
)
@@ -98,7 +98,6 @@ type Validator struct {
9898
// With josev2 `jose.JSONWebKeySet` is supported as a return type of
9999
// this function which hands off the heavy lifting of determining which
100100
// key to used based on the header `kid` to the josev2 library.
101-
// TODO(joncarl): provide an example of using a kid
102101
keyFunc func(context.Context) (interface{}, error)
103102
signatureAlgorithm jose.SignatureAlgorithm
104103

validate/josev2/josev2_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"crypto/rsa"
77
"crypto/x509"
88
"encoding/json"
9-
"errors"
109
"math/big"
1110
"net/http"
1211
"net/http/httptest"
@@ -17,6 +16,7 @@ import (
1716

1817
"github.com/auth0/go-jwt-middleware/internal/oidc"
1918
"github.com/google/go-cmp/cmp"
19+
"github.com/pkg/errors"
2020
"gopkg.in/square/go-jose.v2"
2121
"gopkg.in/square/go-jose.v2/jwt"
2222
)

validate/jwt-go/examples/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ package main
33
import (
44
"context"
55
"encoding/json"
6-
"errors"
76
"fmt"
87
"net/http"
98

109
jwtmiddleware "github.com/auth0/go-jwt-middleware"
1110
jwtgo "github.com/auth0/go-jwt-middleware/validate/jwt-go"
1211
"github.com/golang-jwt/jwt"
12+
"github.com/pkg/errors"
1313
)
1414

1515
// CustomClaimsExample contains custom data we want from the token.

validate/jwt-go/jwtgo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ package jwtgo
22

33
import (
44
"context"
5-
"errors"
65
"fmt"
76

87
"github.com/golang-jwt/jwt"
8+
"github.com/pkg/errors"
99
)
1010

1111
// CustomClaims defines any custom data / claims wanted. The validator will

0 commit comments

Comments
 (0)