Skip to content

Commit 76a7f79

Browse files
jwk autofrefresh
1 parent 54977f4 commit 76a7f79

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

RISC/webhook.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ func registerWebhook(ctx context.Context) {
7171
risc := config.Subrouter(config.Get().RISC.Webhook)
7272
risc.HandleFunc("", webhook).Methods("POST")
7373

74-
ar := jwk.NewAutoRefresh(ctx)
75-
ar.Configure(googleConfig.JWKURI, jwk.WithMinRefreshInterval(time.Hour))
76-
tmp, err := ar.Refresh(ctx, googleConfig.JWKURI)
74+
c := jwk.NewCache(ctx)
75+
c.Register(googleConfig.JWKURI) // , jwk.WithMinRefreshInterval(time.Hour))
76+
tmp, err := c.Get(ctx, googleConfig.JWKURI)
7777
if err != nil {
7878
log.Error(err)
7979
return
@@ -99,7 +99,7 @@ func registerWebhook(ctx context.Context) {
9999
case <-ctx.Done():
100100
return
101101
case <-ticker.C:
102-
tmp, err := ar.Fetch(ctx, googleConfig.JWKURI)
102+
tmp, err := c.Refresh(ctx, googleConfig.JWKURI)
103103
if err != nil {
104104
log.Error(err)
105105
return

0 commit comments

Comments
 (0)