Skip to content

Commit 4a25c8c

Browse files
committed
fix: Fixed examples
1 parent 1898950 commit 4a25c8c

File tree

13 files changed

+38
-34
lines changed

13 files changed

+38
-34
lines changed

examples/echo-example/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ To try this out:
1010
* Run `go run .` to start the app.
1111
* Use [jwt.io](https://jwt.io/) to generate a JWT signed with the HS256 algorithm and `secret`.
1212
* Call `http://localhost:3000` with the JWT to get a response back.
13+
* see `main.go` for example tokens

examples/echo-example/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import (
1111

1212
// Try it out with:
1313
//
14-
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnby1qd3QtbWlkZGxld2FyZS1leGFtcGxlIiwiYXVkIjoiYXVkaWVuY2UtZXhhbXBsZSIsInN1YiI6IjEyMzQ1Njc4OTAiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE1MTYyMzkwMjIsInVzZXJuYW1lIjoidXNlcjEyMyJ9.XFhrzWzntyINkgoRt2mb8dES84dJcuOoORdzKfwUX70
14+
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnby1qd3QtbWlkZGxld2FyZS1leGFtcGxlIiwiYXVkIjoiYXVkaWVuY2UtZXhhbXBsZSIsInN1YiI6IjEyMzQ1Njc4OTAiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE1MTYyMzkwMjIsInVzZXJuYW1lIjoidXNlcjEyMyJ9.DSY4NlpZZ2mOqaKuXvJkOrgZA3nD5HuGaf1wB9-0OVw
1515
//
16-
// which is signed with 'secret' and has the data:
16+
// which is signed with 'abcdefghijklmnopqrstuvwxyz012345' and has the data:
1717
//
1818
// {
1919
// "iss": "go-jwt-middleware-example",
@@ -26,9 +26,9 @@ import (
2626
//
2727
// You can also try out the custom validation with:
2828
//
29-
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnby1qd3QtbWlkZGxld2FyZS1leGFtcGxlIiwiYXVkIjoiYXVkaWVuY2UtZXhhbXBsZSIsInN1YiI6IjEyMzQ1Njc4OTAiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE1MTYyMzkwMjIsInVzZXJuYW1lIjoidXNlcjEyMyIsInNob3VsZFJlamVjdCI6dHJ1ZX0.Jf13PY_Oyu2x3Gx1JQ0jXRiWaCOb5T2RbKOrTPBNHJA
29+
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnby1qd3QtbWlkZGxld2FyZS1leGFtcGxlIiwiYXVkIjoiYXVkaWVuY2UtZXhhbXBsZSIsInN1YiI6IjEyMzQ1Njc4OTAiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE1MTYyMzkwMjIsInVzZXJuYW1lIjoidXNlcjEyMyIsInNob3VsZFJlamVjdCI6dHJ1ZX0.qjjJBgKNomlbEQrCobpEU9ASgvSpLQhQBryRkp6-RQc
3030
//
31-
// which is signed with 'secret' and has the data:
31+
// which is signed with 'abcdefghijklmnopqrstuvwxyz012345' and has the data:
3232
//
3333
// {
3434
// "iss": "go-jwt-middleware-example",

examples/echo-example/middleware.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313

1414
var (
1515
// The signing key for the token.
16-
signingKey = []byte("secret")
16+
signingKey = []byte("abcdefghijklmnopqrstuvwxyz012345")
1717

1818
// The issuer of our token.
1919
issuer = "go-jwt-middleware-example"

examples/gin-example/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ To try this out:
1010
* Run `go run .` to start the app.
1111
* Use [jwt.io](https://jwt.io/) to generate a JWT signed with the HS256 algorithm and `secret`.
1212
* Call `http://localhost:3000` with the JWT to get a response back.
13+
* see `main.go` for example tokens

examples/gin-example/main.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import (
1111

1212
// Try it out with:
1313
//
14-
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnby1qd3QtbWlkZGxld2FyZS1leGFtcGxlIiwiYXVkIjoiYXVkaWVuY2UtZXhhbXBsZSIsInN1YiI6IjEyMzQ1Njc4OTAiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE1MTYyMzkwMjIsInVzZXJuYW1lIjoidXNlcjEyMyJ9.XFhrzWzntyINkgoRt2mb8dES84dJcuOoORdzKfwUX70
14+
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnby1qd3QtbWlkZGxld2FyZS1leGFtcGxlIiwiYXVkIjoiYXVkaWVuY2UtZXhhbXBsZSIsInN1YiI6IjEyMzQ1Njc4OTAiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE1MTYyMzkwMjIsInVzZXJuYW1lIjoidXNlcjEyMyJ9.DSY4NlpZZ2mOqaKuXvJkOrgZA3nD5HuGaf1wB9-0OVw
1515
//
16-
// which is signed with 'secret' and has the data:
16+
// which is signed with 'abcdefghijklmnopqrstuvwxyz012345' and has the data:
1717
//
1818
// {
1919
// "iss": "go-jwt-middleware-example",
@@ -26,9 +26,9 @@ import (
2626
//
2727
// You can also try out the custom validation with:
2828
//
29-
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnby1qd3QtbWlkZGxld2FyZS1leGFtcGxlIiwiYXVkIjoiYXVkaWVuY2UtZXhhbXBsZSIsInN1YiI6IjEyMzQ1Njc4OTAiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE1MTYyMzkwMjIsInVzZXJuYW1lIjoidXNlcjEyMyIsInNob3VsZFJlamVjdCI6dHJ1ZX0.Jf13PY_Oyu2x3Gx1JQ0jXRiWaCOb5T2RbKOrTPBNHJA
29+
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnby1qd3QtbWlkZGxld2FyZS1leGFtcGxlIiwiYXVkIjoiYXVkaWVuY2UtZXhhbXBsZSIsInN1YiI6IjEyMzQ1Njc4OTAiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE1MTYyMzkwMjIsInVzZXJuYW1lIjoidXNlcjEyMyIsInNob3VsZFJlamVjdCI6dHJ1ZX0.qjjJBgKNomlbEQrCobpEU9ASgvSpLQhQBryRkp6-RQc
3030
//
31-
// which is signed with 'secret' and has the data:
31+
// which is signed with 'abcdefghijklmnopqrstuvwxyz012345' and has the data:
3232
//
3333
// {
3434
// "iss": "go-jwt-middleware-example",
@@ -43,9 +43,9 @@ import (
4343
// You can also try out the /multiple endpoint. This endpoint accepts tokens signed by multiple issuers. Try the
4444
// token below which has a different issuer:
4545
//
46-
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnby1qd3QtbWlkZGxld2FyZS1tdWx0aXBsZS1leGFtcGxlIiwiYXVkIjoiYXVkaWVuY2UtbXVsdGlwbGUtZXhhbXBsZSIsInN1YiI6IjEyMzQ1Njc4OTAiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE1MTYyMzkwMjIsInVzZXJuYW1lIjoidXNlcjEyMyJ9.9zV_bY1wAmQlMCPlXOppx1Y9_z_T_wNng9-yfQk4I0c
46+
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnby1qd3QtbWlkZGxld2FyZS1tdWx0aXBsZS1leGFtcGxlIiwiYXVkIjoiYXVkaWVuY2UtbXVsdGlwbGUtZXhhbXBsZSIsInN1YiI6IjEyMzQ1Njc4OTAiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE1MTYyMzkwMjIsInVzZXJuYW1lIjoidXNlcjEyMyJ9.d0BmhdqVZ9IdqQNId3XI2kbTegwW5NYe9P4xQCOjQ1Y
4747
//
48-
// which is signed with 'secret' and has the data:
48+
// which is signed with 'abcdefghijklmnopqrstuvwxyz012345' and has the data:
4949
//
5050
// {
5151
// "iss": "go-jwt-middleware-multiple-example",

examples/gin-example/middleware.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414

1515
var (
1616
// The signing key for the token.
17-
signingKey = []byte("secret")
17+
signingKey = []byte("abcdefghijklmnopqrstuvwxyz012345")
1818

1919
// The issuer of our token.
2020
issuer = "go-jwt-middleware-example"

examples/http-example/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ To try this out:
1010
* Run `go run main.go` to start the app.
1111
* Use [jwt.io](https://jwt.io/) to generate a JWT signed with the HS256 algorithm and `secret`.
1212
* Call `http://localhost:3000` with the JWT to get a response back.
13+
* see `main.go` for example tokens

examples/http-example/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
)
1414

1515
var (
16-
signingKey = []byte("secret")
16+
signingKey = []byte("abcdefghijklmnopqrstuvwxyz012345")
1717
issuer = "go-jwt-middleware-example"
1818
audience = []string{"audience-example"}
1919
)
@@ -93,9 +93,9 @@ func main() {
9393

9494
// Try it out with:
9595
//
96-
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnby1qd3QtbWlkZGxld2FyZS1leGFtcGxlIiwiYXVkIjoiYXVkaWVuY2UtZXhhbXBsZSIsInN1YiI6IjEyMzQ1Njc4OTAiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE1MTYyMzkwMjIsInVzZXJuYW1lIjoidXNlcjEyMyJ9.XFhrzWzntyINkgoRt2mb8dES84dJcuOoORdzKfwUX70
96+
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnby1qd3QtbWlkZGxld2FyZS1leGFtcGxlIiwiYXVkIjoiYXVkaWVuY2UtZXhhbXBsZSIsInN1YiI6IjEyMzQ1Njc4OTAiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE1MTYyMzkwMjIsInVzZXJuYW1lIjoidXNlcjEyMyJ9.DSY4NlpZZ2mOqaKuXvJkOrgZA3nD5HuGaf1wB9-0OVw
9797
//
98-
// which is signed with 'secret' and has the data:
98+
// which is signed with 'abcdefghijklmnopqrstuvwxyz012345' and has the data:
9999
// {
100100
// "iss": "go-jwt-middleware-example",
101101
// "aud": "audience-example",
@@ -107,9 +107,9 @@ func main() {
107107
//
108108
// You can also try out the custom validation with:
109109
//
110-
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnby1qd3QtbWlkZGxld2FyZS1leGFtcGxlIiwiYXVkIjoiYXVkaWVuY2UtZXhhbXBsZSIsInN1YiI6IjEyMzQ1Njc4OTAiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE1MTYyMzkwMjIsInVzZXJuYW1lIjoidXNlcjEyMyIsInNob3VsZFJlamVjdCI6dHJ1ZX0.Jf13PY_Oyu2x3Gx1JQ0jXRiWaCOb5T2RbKOrTPBNHJA
110+
// eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnby1qd3QtbWlkZGxld2FyZS1leGFtcGxlIiwiYXVkIjoiYXVkaWVuY2UtZXhhbXBsZSIsInN1YiI6IjEyMzQ1Njc4OTAiLCJuYW1lIjoiSm9obiBEb2UiLCJpYXQiOjE1MTYyMzkwMjIsInVzZXJuYW1lIjoidXNlcjEyMyIsInNob3VsZFJlamVjdCI6dHJ1ZX0.qjjJBgKNomlbEQrCobpEU9ASgvSpLQhQBryRkp6-RQc
111111
//
112-
// which is signed with 'secret' and has the data:
112+
// which is signed with 'abcdefghijklmnopqrstuvwxyz012345' and has the data:
113113
// {
114114
// "iss": "go-jwt-middleware-example",
115115
// "aud": "audience-example",

examples/iris-example/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ To try this out:
1010
* Run `go run .` to start the app.
1111
* Use [jwt.io](https://jwt.io/) to generate a JWT signed with the HS256 algorithm and `secret`.
1212
* Call `http://localhost:3000` with the JWT to get a response back.
13+
* see `main.go` for example tokens

examples/iris-example/go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ require (
1919
github.com/aymerick/douceur v0.2.0 // indirect
2020
github.com/fatih/structs v1.1.0 // indirect
2121
github.com/flosch/pongo2/v4 v4.0.2 // indirect
22+
github.com/go-jose/go-jose/v4 v4.0.4 // indirect
2223
github.com/golang/snappy v0.0.4 // indirect
2324
github.com/gomarkdown/markdown v0.0.0-20230922112808-5421fefb8386 // indirect
2425
github.com/google/uuid v1.3.1 // indirect
@@ -43,14 +44,13 @@ require (
4344
github.com/vmihailenco/msgpack/v5 v5.4.0 // indirect
4445
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
4546
github.com/yosssi/ace v0.0.5 // indirect
46-
golang.org/x/crypto v0.21.0 // indirect
47+
golang.org/x/crypto v0.25.0 // indirect
4748
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
4849
golang.org/x/net v0.23.0 // indirect
49-
golang.org/x/sys v0.18.0 // indirect
50-
golang.org/x/text v0.14.0 // indirect
50+
golang.org/x/sys v0.22.0 // indirect
51+
golang.org/x/text v0.16.0 // indirect
5152
golang.org/x/time v0.3.0 // indirect
5253
google.golang.org/protobuf v1.33.0 // indirect
53-
gopkg.in/go-jose/go-jose.v2 v2.6.3 // indirect
5454
gopkg.in/ini.v1 v1.67.0 // indirect
5555
gopkg.in/yaml.v3 v3.0.1 // indirect
5656
)

0 commit comments

Comments
 (0)