From eb2713a9bb03ae0f1a9b5edd4ef0303d3d887e25 Mon Sep 17 00:00:00 2001 From: Alex Snaps Date: Thu, 24 Oct 2024 15:45:12 -0400 Subject: [PATCH] Did we screw up named patterns somehow Signed-off-by: Alex Snaps --- controllers/auth_config_controller.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/controllers/auth_config_controller.go b/controllers/auth_config_controller.go index e871c961..b34a3e1e 100644 --- a/controllers/auth_config_controller.go +++ b/controllers/auth_config_controller.go @@ -1001,21 +1001,15 @@ func buildPredicates(authConfig *api.AuthConfig, patterns []api.PatternExpressio func buildJSONExpressionPatterns(authConfig *api.AuthConfig, pattern api.PatternExpressionOrRef) ([]jsonexp.Expression, error) { expressionsToAdd := api.PatternExpressions{} - expressions := make([]jsonexp.Expression, len(expressionsToAdd)) if expressionsByRef, found := authConfig.Spec.NamedPatterns[pattern.PatternRef.Name]; found { expressionsToAdd = append(expressionsToAdd, expressionsByRef...) } else if pattern.PatternExpression.Operator != "" { expressionsToAdd = append(expressionsToAdd, pattern.PatternExpression) - } else if pattern.Predicate != "" { - if predicate, err := cel.NewPredicate(pattern.Predicate); err != nil { - return nil, err - } else { - expressions = append(expressions, predicate) - } } - for _, expression := range expressionsToAdd { - expressions = append(expressions, buildJSONExpressionPattern(expression)) + expressions := make([]jsonexp.Expression, len(expressionsToAdd)) + for i, expression := range expressionsToAdd { + expressions[i] = buildJSONExpressionPattern(expression) } return expressions, nil }