Skip to content

Commit 30caf25

Browse files
committed
chore(deps): bump jwt
1 parent 4a18483 commit 30caf25

File tree

5 files changed

+18
-11
lines changed

5 files changed

+18
-11
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG GOLANG_VERSION=1.21
1+
ARG GOLANG_VERSION=1.22
22

33
FROM golang:${GOLANG_VERSION} as builder
44

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ toolchain go1.22.1
77
require (
88
github.com/coreos/go-oidc/v3 v3.10.0
99
github.com/gin-gonic/gin v1.9.1
10-
github.com/golang-jwt/jwt/v4 v4.5.0
10+
github.com/golang-jwt/jwt/v5 v5.2.1
1111
github.com/kelseyhightower/envconfig v1.4.0
1212
github.com/stretchr/testify v1.9.0
1313
github.com/ydataai/go-core v0.15.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ github.com/go-playground/validator/v10 v10.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn
3232
github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
3333
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
3434
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
35-
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
36-
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
35+
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
36+
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
3737
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
3838
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
3939
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=

internal/models/tokens.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"encoding/json"
55
"time"
66

7-
"github.com/golang-jwt/jwt/v4"
7+
"github.com/golang-jwt/jwt/v5"
88
)
99

1010
// Tokens defines the token struct.

internal/services/oidc.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"fmt"
88
"time"
99

10-
"github.com/golang-jwt/jwt/v4"
10+
"github.com/golang-jwt/jwt/v5"
1111

1212
"github.com/ydataai/authentication-service/internal/clients"
1313
"github.com/ydataai/authentication-service/internal/configurations"
@@ -148,17 +148,24 @@ func (osvc *OAuth2OIDCService) Decode(tokenString string) (models.UserInfo, erro
148148
}, nil
149149
}
150150

151-
if ve, ok := err.(*jwt.ValidationError); ok {
152-
if ve.Errors&jwt.ValidationErrorMalformed != 0 {
151+
if err != nil {
152+
if err == jwt.ErrTokenMalformed {
153153
return models.UserInfo{}, authErrors.ErrorTokenMalformed
154-
} else if ve.Errors&jwt.ValidationErrorExpired != 0 {
154+
}
155+
156+
if err == jwt.ErrTokenExpired {
155157
return models.UserInfo{}, authErrors.ErrorTokenExpired
156-
} else if ve.Errors&jwt.ValidationErrorNotValidYet != 0 {
158+
}
159+
160+
if err == jwt.ErrTokenNotValidYet {
157161
return models.UserInfo{}, authErrors.ErrorTokenInactive
158-
} else if ve.Errors&jwt.ValidationErrorSignatureInvalid != 0 {
162+
}
163+
164+
if err == jwt.ErrTokenSignatureInvalid {
159165
return models.UserInfo{}, authErrors.ErrorTokenSignatureInvalid
160166
}
161167
}
168+
162169
return models.UserInfo{}, fmt.Errorf("couldn't handle this token: %v", err)
163170
}
164171

0 commit comments

Comments
 (0)