Skip to content

Commit

Permalink
Tentative at dealing with no Response provided
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Snaps <[email protected]>
  • Loading branch information
alexsnaps committed Sep 4, 2024
1 parent 37ef7d1 commit 6d46e21
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions controllers/auth_config_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,27 +472,29 @@ func (r *AuthConfigReconciler) translateAuthConfig(ctx context.Context, authConf

interfacedResponseConfigs := make([]auth.AuthConfigEvaluator, 0)

for responseName, headerResponse := range authConfig.Spec.Response.Success.Headers {
translatedResponse := evaluators.NewResponseConfig(
responseName,
headerResponse.Priority,
buildJSONExpression(authConfig, headerResponse.Conditions, jsonexp.All),
"httpHeader",
headerResponse.Key,
headerResponse.Metrics,
)
if authConfig.Spec.Response != nil {
for responseName, headerResponse := range authConfig.Spec.Response.Success.Headers {
translatedResponse := evaluators.NewResponseConfig(
responseName,
headerResponse.Priority,
buildJSONExpression(authConfig, headerResponse.Conditions, jsonexp.All),
"httpHeader",
headerResponse.Key,
headerResponse.Metrics,
)

if headerResponse.Cache != nil {
ttl := headerResponse.Cache.TTL
if ttl == 0 {
ttl = api.EvaluatorDefaultCacheTTL
if headerResponse.Cache != nil {
ttl := headerResponse.Cache.TTL
if ttl == 0 {
ttl = api.EvaluatorDefaultCacheTTL
}
translatedResponse.Cache = evaluators.NewEvaluatorCache(
*getJsonFromStaticDynamic(&headerResponse.Cache.Key),
ttl,
)
}
translatedResponse.Cache = evaluators.NewEvaluatorCache(
*getJsonFromStaticDynamic(&headerResponse.Cache.Key),
ttl,
)
interfacedResponseConfigs = append(interfacedResponseConfigs, translatedResponse)
}
interfacedResponseConfigs = append(interfacedResponseConfigs, translatedResponse)
}

for responseName, response := range authConfig.Spec.Response.Success.DynamicMetadata {
Expand Down

0 comments on commit 6d46e21

Please sign in to comment.