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

chore: bump golang-jwt to v5 #1171

Merged
merged 1 commit into from
Sep 23, 2024
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
2 changes: 1 addition & 1 deletion credentials/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"context"
"net/url"

"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
)

type Signer interface {
Expand Down
2 changes: 1 addition & 1 deletion credentials/signer_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"reflect"

"github.com/go-jose/go-jose/v3"
"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
"github.com/pkg/errors"
"golang.org/x/crypto/ed25519"
)
Expand Down
2 changes: 1 addition & 1 deletion credentials/signer_default_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"
"time"

"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"

"github.com/ory/oathkeeper/internal"
)
Expand Down
2 changes: 1 addition & 1 deletion credentials/signer_default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"testing"
"time"

"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
"github.com/pkg/errors"
"github.com/stretchr/testify/require"

Expand Down
2 changes: 1 addition & 1 deletion credentials/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"context"
"net/url"

"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"

"github.com/ory/fosite"
)
Expand Down
16 changes: 8 additions & 8 deletions credentials/verifier_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"fmt"
"strings"

"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
"github.com/pkg/errors"

"github.com/ory/fosite"
Expand Down Expand Up @@ -82,14 +82,14 @@ func (v *VerifierDefault) Verify(
}

return nil, errors.WithStack(herodot.ErrBadRequest.WithReasonf(`The signing key algorithm does not match the algorithm from the token header.`))
})
}, jwt.WithIssuedAt())
if err != nil {
if e, ok := errors.Cause(err).(*jwt.ValidationError); ok {
aeneasr marked this conversation as resolved.
Show resolved Hide resolved
if _, ok := errors.Cause(e.Inner).(*herodot.DefaultError); !ok {
return nil, herodot.ErrInternalServerError.WithErrorf(e.Error()).WithTrace(err)
}

return nil, e.Inner
if errors.Is(err, jwt.ErrTokenUnverifiable) ||
errors.Is(err, jwt.ErrTokenUnverifiable) ||
errors.Is(err, jwt.ErrTokenSignatureInvalid) ||
errors.Is(err, jwt.ErrTokenInvalidClaims) ||
errors.Is(err, jwt.ErrTokenMalformed) {
return nil, herodot.ErrInternalServerError.WithErrorf(err.Error()).WithTrace(err)
}
return nil, err
} else if !t.Valid {
Expand Down
2 changes: 1 addition & 1 deletion credentials/verifier_default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"testing"
"time"

"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
github.com/go-swagger/go-swagger v0.30.0
github.com/gobuffalo/httptest v1.5.2
github.com/gobwas/glob v0.2.3
github.com/golang-jwt/jwt/v4 v4.4.3
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/golang/gddo v0.0.0-20190904175337-72a348e765d2
github.com/golang/mock v1.6.0
github.com/google/go-replayers/httpreplay v1.1.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,8 @@ github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang-jwt/jwt/v4 v4.4.3 h1:Hxl6lhQFj4AnOX6MLrsCb/+7tCj7DxP7VA+2rDIq5AU=
github.com/golang-jwt/jwt/v4 v4.4.3/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang/gddo v0.0.0-20190904175337-72a348e765d2 h1:xisWqjiKEff2B0KfFYGpCqc3M3zdTz+OHQHRc09FeYk=
github.com/golang/gddo v0.0.0-20190904175337-72a348e765d2/go.mod h1:xEhNfoBDX1hzLm2Nf80qUvZ2sVwoMZ8d6IE2SrsQfh4=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
Expand Down
4 changes: 2 additions & 2 deletions pipeline/authn/authenticator_jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"net/http"
"strings"

"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
"github.com/pkg/errors"
"go.opentelemetry.io/otel/trace"

Expand Down Expand Up @@ -130,7 +130,7 @@ func (a *AuthenticatorJWT) Authenticate(r *http.Request, session *Authentication
}

func (a *AuthenticatorJWT) tryEnrichResultErr(token string, err *herodot.DefaultError) *herodot.DefaultError {
t, _ := jwt.ParseWithClaims(token, jwt.MapClaims{}, nil)
t, _ := jwt.ParseWithClaims(token, jwt.MapClaims{}, nil, jwt.WithIssuedAt())
if t == nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion pipeline/authn/authenticator_jwt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"testing"
"time"

"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"
"github.com/tidwall/sjson"

"github.com/ory/herodot"
Expand Down
2 changes: 1 addition & 1 deletion pipeline/mutate/mutator_id_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

"github.com/dgraph-io/ristretto"

"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"

"github.com/pborman/uuid"
"github.com/pkg/errors"
Expand Down
2 changes: 1 addition & 1 deletion pipeline/mutate/mutator_id_token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/ory/oathkeeper/x"
"github.com/ory/x/configx"

"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"

"github.com/ory/oathkeeper/credentials"
"github.com/ory/oathkeeper/driver/configuration"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/okclient/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"time"

"github.com/go-jose/go-jose/v3"
"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v5"

"github.com/ory/oathkeeper/x"
"github.com/ory/x/cmdx"
Expand Down
Loading