diff --git a/pkg/evaluators/authorization.go b/pkg/evaluators/authorization.go index a23f5059..765d0d2c 100644 --- a/pkg/evaluators/authorization.go +++ b/pkg/evaluators/authorization.go @@ -58,10 +58,12 @@ func (config *AuthorizationConfig) Call(pipeline auth.AuthPipeline, ctx context. if cache != nil { cacheKey, _ = cache.ResolveKeyFor(pipeline.GetAuthorizationJSON()) - if cachedObj, err := cache.Get(cacheKey); err != nil { - logger.V(1).Error(err, "failed to retrieve data from the cache") - } else if cachedObj != nil { - return cachedObj, nil + if cacheKey != nil { + if cachedObj, err := cache.Get(cacheKey); err != nil { + logger.V(1).Error(err, "failed to retrieve data from the cache") + } else if cachedObj != nil { + return cachedObj, nil + } } } diff --git a/pkg/evaluators/identity.go b/pkg/evaluators/identity.go index 887b8a41..0bce9cbf 100644 --- a/pkg/evaluators/identity.go +++ b/pkg/evaluators/identity.go @@ -85,10 +85,12 @@ func (config *IdentityConfig) Call(pipeline auth.AuthPipeline, ctx context.Conte if cache != nil { cacheKey, _ = cache.ResolveKeyFor(pipeline.GetAuthorizationJSON()) - if cachedObj, err := cache.Get(cacheKey); err != nil { - logger.V(1).Error(err, "failed to retrieve data from the cache") - } else if cachedObj != nil { - return cachedObj, nil + if cacheKey != nil { + if cachedObj, err := cache.Get(cacheKey); err != nil { + logger.V(1).Error(err, "failed to retrieve data from the cache") + } else if cachedObj != nil { + return cachedObj, nil + } } } diff --git a/pkg/evaluators/metadata.go b/pkg/evaluators/metadata.go index f04d5695..02fc2602 100644 --- a/pkg/evaluators/metadata.go +++ b/pkg/evaluators/metadata.go @@ -54,10 +54,12 @@ func (config *MetadataConfig) Call(pipeline auth.AuthPipeline, ctx context.Conte if cache != nil { cacheKey, _ = cache.ResolveKeyFor(pipeline.GetAuthorizationJSON()) - if cachedObj, err := cache.Get(cacheKey); err != nil { - logger.V(1).Error(err, "failed to retrieve data from the cache") - } else if cachedObj != nil { - return cachedObj, nil + if cacheKey != nil { + if cachedObj, err := cache.Get(cacheKey); err != nil { + logger.V(1).Error(err, "failed to retrieve data from the cache") + } else if cachedObj != nil { + return cachedObj, nil + } } } diff --git a/pkg/evaluators/response.go b/pkg/evaluators/response.go index f116ad7e..b3a4af00 100644 --- a/pkg/evaluators/response.go +++ b/pkg/evaluators/response.go @@ -83,10 +83,12 @@ func (config *ResponseConfig) Call(pipeline auth.AuthPipeline, ctx context.Conte if cache != nil { cacheKey, _ = cache.ResolveKeyFor(pipeline.GetAuthorizationJSON()) - if cachedObj, err := cache.Get(cacheKey); err != nil { - logger.V(1).Error(err, "failed to retrieve data from the cache") - } else if cachedObj != nil { - return cachedObj, nil + if cacheKey != nil { + if cachedObj, err := cache.Get(cacheKey); err != nil { + logger.V(1).Error(err, "failed to retrieve data from the cache") + } else if cachedObj != nil { + return cachedObj, nil + } } }