-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adds support for `v5` of the `golang-jwt` library For better future maintainability, we had to change the way signing methods work slightly. Instead of decoding/encoding the token in the signing method, this is now done in the library itself. This should also make code in projects like this a little bit easier and cleaner. Fixes #13 * v5 release --------- Co-authored-by: Máté Lang <[email protected]>
- Loading branch information
Showing
7 changed files
with
40 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ import ( | |
|
||
"github.com/aws/aws-sdk-go-v2/config" | ||
"github.com/aws/aws-sdk-go-v2/service/kms" | ||
"github.com/golang-jwt/jwt/v4" | ||
"github.com/golang-jwt/jwt/v5" | ||
"github.com/matelang/jwt-go-aws-kms/v2/jwtkms" | ||
) | ||
|
||
|
@@ -21,13 +21,13 @@ func main() { | |
} | ||
|
||
now := time.Now() | ||
jwtToken := jwt.NewWithClaims(jwtkms.SigningMethodECDSA256, &jwt.StandardClaims{ | ||
Audience: "api.example.com", | ||
ExpiresAt: now.Add(1 * time.Hour * 24).Unix(), | ||
Id: "1234-5678", | ||
IssuedAt: now.Unix(), | ||
jwtToken := jwt.NewWithClaims(jwtkms.SigningMethodECDSA256, &jwt.RegisteredClaims{ | ||
Audience: jwt.ClaimStrings{"api.example.com"}, | ||
ExpiresAt: jwt.NewNumericDate(now.Add(1 * time.Hour * 24)), | ||
ID: "1234-5678", | ||
IssuedAt: jwt.NewNumericDate(now), | ||
Issuer: "sso.example.com", | ||
NotBefore: now.Unix(), | ||
NotBefore: jwt.NewNumericDate(now), | ||
Subject: "[email protected]", | ||
}) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,24 @@ | ||
module github.com/matelang/jwt-go-aws-kms/v2 | ||
|
||
go 1.16 | ||
go 1.18 | ||
|
||
require ( | ||
github.com/aws/aws-sdk-go-v2 v1.17.7 | ||
github.com/aws/aws-sdk-go-v2/config v1.18.19 | ||
github.com/aws/aws-sdk-go-v2/service/kms v1.20.8 | ||
github.com/golang-jwt/jwt/v4 v4.5.0 | ||
github.com/golang-jwt/jwt/v5 v5.0.0 | ||
github.com/google/uuid v1.3.0 | ||
) | ||
|
||
require ( | ||
github.com/aws/aws-sdk-go-v2/credentials v1.13.18 // indirect | ||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.1 // indirect | ||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.31 // indirect | ||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.25 // indirect | ||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.32 // indirect | ||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.25 // indirect | ||
github.com/aws/aws-sdk-go-v2/service/sso v1.12.6 // indirect | ||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.6 // indirect | ||
github.com/aws/aws-sdk-go-v2/service/sts v1.18.7 // indirect | ||
github.com/aws/smithy-go v1.13.5 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters