Skip to content

Commit 5ebc1cb

Browse files
authored
feat: add jwks fetcher (#720)
Adds an efficient fetcher for JSON Web Key Sets. The fetcher is able to cache results for a given TTL, if desired.
1 parent 577e4fb commit 5ebc1cb

11 files changed

+509
-50
lines changed

fetcher/fetcher.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ func newOpts() *opts {
4444
}
4545
}
4646

47+
type Modifier func(*opts)
48+
4749
// NewFetcher creates a new fetcher instance.
48-
func NewFetcher(opts ...func(*opts)) *Fetcher {
50+
func NewFetcher(opts ...Modifier) *Fetcher {
4951
o := newOpts()
5052
for _, f := range opts {
5153
f(o)

go.mod

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require (
1313
github.com/docker/docker v20.10.24+incompatible
1414
github.com/evanphx/json-patch/v5 v5.6.0
1515
github.com/fatih/structs v1.1.0
16-
github.com/form3tech-oss/jwt-go v3.2.2+incompatible
16+
github.com/form3tech-oss/jwt-go v3.2.5+incompatible
1717
github.com/fsnotify/fsnotify v1.6.0
1818
github.com/ghodss/yaml v1.0.0
1919
github.com/go-bindata/go-bindata v3.1.2+incompatible
@@ -24,6 +24,7 @@ require (
2424
github.com/gobuffalo/fizz v1.14.4
2525
github.com/gobuffalo/httptest v1.5.2
2626
github.com/gobuffalo/pop/v6 v6.0.8
27+
github.com/gobwas/glob v0.2.3
2728
github.com/goccy/go-yaml v1.9.6
2829
github.com/gofrs/uuid v4.3.0+incompatible
2930
github.com/golang/mock v1.6.0
@@ -44,6 +45,8 @@ require (
4445
github.com/knadh/koanf/providers/posflag v0.1.0
4546
github.com/knadh/koanf/providers/rawbytes v0.1.0
4647
github.com/knadh/koanf/v2 v2.0.1
48+
github.com/laher/mergefs v0.1.1
49+
github.com/lestrrat-go/jwx v1.2.26
4750
github.com/lib/pq v1.10.7
4851
github.com/luna-duclos/instrumentedsql v1.1.3
4952
github.com/markbates/pkger v0.17.1
@@ -52,7 +55,7 @@ require (
5255
github.com/ory/analytics-go/v5 v5.0.1
5356
github.com/ory/dockertest/v3 v3.9.1
5457
github.com/ory/go-acc v0.2.9-0.20230103102148-6b1c9a70dbbe
55-
github.com/ory/herodot v0.10.3-0.20230626083119-d7e5192f0d88
58+
github.com/ory/herodot v0.9.13
5659
github.com/ory/jsonschema/v3 v3.0.7
5760
github.com/pelletier/go-toml v1.9.5
5861
github.com/pkg/errors v0.9.1
@@ -65,9 +68,9 @@ require (
6568
github.com/seatgeek/logrus-gelf-formatter v0.0.0-20210414080842-5b05eb8ff761
6669
github.com/sirupsen/logrus v1.9.0
6770
github.com/spf13/cast v1.5.0
68-
github.com/spf13/cobra v1.7.0
71+
github.com/spf13/cobra v1.6.1
6972
github.com/spf13/pflag v1.0.5
70-
github.com/stretchr/testify v1.8.1
73+
github.com/stretchr/testify v1.8.4
7174
github.com/tidwall/gjson v1.14.3
7275
github.com/tidwall/pretty v1.2.1
7376
github.com/tidwall/sjson v1.2.5
@@ -86,17 +89,15 @@ require (
8689
go.opentelemetry.io/otel/trace v1.11.1
8790
go.opentelemetry.io/proto/otlp v0.18.0
8891
go.uber.org/goleak v1.2.1
89-
golang.org/x/crypto v0.1.0
90-
golang.org/x/mod v0.10.0
91-
golang.org/x/net v0.8.0
92+
golang.org/x/crypto v0.9.0
93+
golang.org/x/mod v0.8.0
94+
golang.org/x/net v0.10.0
9295
golang.org/x/sync v0.1.0
9396
gonum.org/v1/plot v0.12.0
94-
google.golang.org/grpc v1.54.0
95-
google.golang.org/protobuf v1.30.0
97+
google.golang.org/grpc v1.53.0
98+
google.golang.org/protobuf v1.28.1
9699
)
97100

98-
require github.com/gobwas/glob v0.2.3 // indirect
99-
100101
require (
101102
git.sr.ht/~sbinet/gg v0.3.1 // indirect
102103
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
@@ -110,6 +111,7 @@ require (
110111
github.com/cespare/xxhash/v2 v2.2.0 // indirect
111112
github.com/containerd/continuity v0.3.0 // indirect
112113
github.com/davecgh/go-spew v1.1.1 // indirect
114+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
113115
github.com/docker/cli v20.10.21+incompatible // indirect
114116
github.com/docker/distribution v2.8.2+incompatible // indirect
115117
github.com/docker/go-connections v0.4.0 // indirect
@@ -135,11 +137,12 @@ require (
135137
github.com/gobuffalo/plush/v4 v4.1.16 // indirect
136138
github.com/gobuffalo/tags/v3 v3.1.4 // indirect
137139
github.com/gobuffalo/validate/v3 v3.3.3 // indirect
140+
github.com/goccy/go-json v0.10.2 // indirect
138141
github.com/gofrs/flock v0.8.1 // indirect
139142
github.com/gogo/protobuf v1.3.2 // indirect
140143
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
141144
github.com/golang/glog v1.0.0 // indirect
142-
github.com/golang/protobuf v1.5.3 // indirect
145+
github.com/golang/protobuf v1.5.2 // indirect
143146
github.com/google/pprof v0.0.0-20221010195024-131d412537ea // indirect
144147
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
145148
github.com/gorilla/css v1.0.0 // indirect
@@ -157,7 +160,11 @@ require (
157160
github.com/joho/godotenv v1.4.0 // indirect
158161
github.com/josharian/intern v1.0.0 // indirect
159162
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
160-
github.com/laher/mergefs v0.1.1
163+
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
164+
github.com/lestrrat-go/blackmagic v1.0.1 // indirect
165+
github.com/lestrrat-go/httpcc v1.0.1 // indirect
166+
github.com/lestrrat-go/iter v1.0.2 // indirect
167+
github.com/lestrrat-go/option v1.0.1 // indirect
161168
github.com/magiconair/properties v1.8.7 // indirect
162169
github.com/mailru/easyjson v0.7.7 // indirect
163170
github.com/mattn/go-colorable v0.1.13 // indirect
@@ -183,11 +190,11 @@ require (
183190
github.com/sergi/go-diff v1.2.0 // indirect
184191
github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d // indirect
185192
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e // indirect
186-
github.com/spf13/afero v1.9.5 // indirect
193+
github.com/spf13/afero v1.9.3 // indirect
187194
github.com/spf13/jwalterweatherman v1.1.0 // indirect
188195
github.com/spf13/viper v1.14.0 // indirect
189196
github.com/stretchr/objx v0.5.0 // indirect
190-
github.com/subosito/gotenv v1.4.2 // indirect
197+
github.com/subosito/gotenv v1.4.1 // indirect
191198
github.com/tidwall/match v1.1.1 // indirect
192199
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
193200
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
@@ -197,12 +204,12 @@ require (
197204
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 // indirect
198205
go.opentelemetry.io/otel/metric v0.33.0 // indirect
199206
golang.org/x/image v0.5.0 // indirect
200-
golang.org/x/sys v0.7.0 // indirect
201-
golang.org/x/text v0.8.0 // indirect
207+
golang.org/x/sys v0.8.0 // indirect
208+
golang.org/x/text v0.9.0 // indirect
202209
golang.org/x/time v0.1.0 // indirect
203-
golang.org/x/tools v0.7.0 // indirect
210+
golang.org/x/tools v0.6.0 // indirect
204211
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
205-
google.golang.org/genproto v0.0.0-20230403163135-c38d8f061ccd // indirect
212+
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
206213
gopkg.in/ini.v1 v1.67.0 // indirect
207214
gopkg.in/yaml.v2 v2.4.0 // indirect
208215
gopkg.in/yaml.v3 v3.0.1 // indirect

0 commit comments

Comments
 (0)