Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use github.com/pkg/errors #98

Merged
merged 1 commit into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.14
require (
github.com/golang-jwt/jwt v3.2.1+incompatible
github.com/google/go-cmp v0.5.6
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.7.0 // indirect
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
gopkg.in/square/go-jose.v2 v2.5.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c=
github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
3 changes: 2 additions & 1 deletion jwtmiddleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package jwtmiddleware

import (
"context"
"errors"
"fmt"
"net/http"
"strings"

"github.com/pkg/errors"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion jwtmiddleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package jwtmiddleware

import (
"context"
"errors"
"fmt"
"io/ioutil"
"net/http"
Expand All @@ -12,6 +11,7 @@ import (

"github.com/auth0/go-jwt-middleware/validate/josev2"
"github.com/google/go-cmp/cmp"
"github.com/pkg/errors"
"gopkg.in/square/go-jose.v2"
"gopkg.in/square/go-jose.v2/jwt"
)
Expand Down
1 change: 0 additions & 1 deletion validate/josev2/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ the Square go-jose package version 2.

The implementation handles some nuances around JWTs and supports:
- a key func to pull the key(s) used to verify the token signature
// TODO(joncarl): maybe we should provide a high level helper func for the above
- verifying the signature algorithm is what it should be
- validation of "regular" claims
- validation of custom claims
Expand Down
2 changes: 1 addition & 1 deletion validate/josev2/examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package main
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"time"

jwtmiddleware "github.com/auth0/go-jwt-middleware"
"github.com/auth0/go-jwt-middleware/validate/josev2"
"github.com/pkg/errors"
"gopkg.in/square/go-jose.v2"
"gopkg.in/square/go-jose.v2/jwt"
)
Expand Down
3 changes: 1 addition & 2 deletions validate/josev2/josev2.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package josev2
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"net/url"
"sync"
"time"

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

Expand Down
2 changes: 1 addition & 1 deletion validate/josev2/josev2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"crypto/rsa"
"crypto/x509"
"encoding/json"
"errors"
"math/big"
"net/http"
"net/http/httptest"
Expand All @@ -17,6 +16,7 @@ import (

"github.com/auth0/go-jwt-middleware/internal/oidc"
"github.com/google/go-cmp/cmp"
"github.com/pkg/errors"
"gopkg.in/square/go-jose.v2"
"gopkg.in/square/go-jose.v2/jwt"
)
Expand Down
2 changes: 1 addition & 1 deletion validate/jwt-go/examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package main
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"

jwtmiddleware "github.com/auth0/go-jwt-middleware"
jwtgo "github.com/auth0/go-jwt-middleware/validate/jwt-go"
"github.com/golang-jwt/jwt"
"github.com/pkg/errors"
)

// CustomClaimsExample contains custom data we want from the token.
Expand Down
2 changes: 1 addition & 1 deletion validate/jwt-go/jwtgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package jwtgo

import (
"context"
"errors"
"fmt"

"github.com/golang-jwt/jwt"
"github.com/pkg/errors"
)

// CustomClaims defines any custom data / claims wanted. The validator will
Expand Down
2 changes: 1 addition & 1 deletion validate/jwt-go/jwtgo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package jwtgo

import (
"context"
"errors"
"testing"

"github.com/golang-jwt/jwt"
"github.com/google/go-cmp/cmp"
"github.com/pkg/errors"
)

type testingCustomClaims struct {
Expand Down