From e78b0483c856f711c29459fce2d3b070f5149c01 Mon Sep 17 00:00:00 2001 From: David Wobrock Date: Thu, 29 Aug 2024 15:13:36 +0200 Subject: [PATCH] fix: add TTL to cached id_token objects --- pipeline/mutate/mutator_id_token.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pipeline/mutate/mutator_id_token.go b/pipeline/mutate/mutator_id_token.go index 1cb7b5428..a33e617f4 100644 --- a/pipeline/mutate/mutator_id_token.go +++ b/pipeline/mutate/mutator_id_token.go @@ -109,11 +109,16 @@ func (a *MutatorIDToken) tokenToCache(config *CredentialsIDTokenConfig, session } key := a.cacheKey(config, ttl, claims, session) - a.tokenCache.Set(key, &idTokenCacheContainer{ - TTL: ttl, - ExpiresAt: expiresAt, - Token: token, - }, 0) + a.tokenCache.SetWithTTL( + key, + &idTokenCacheContainer{ + TTL: ttl, + ExpiresAt: expiresAt, + Token: token, + }, + 0, + ttl, + ) } func (a *MutatorIDToken) Mutate(r *http.Request, session *authn.AuthenticationSession, config json.RawMessage, rl pipeline.Rule) error {