From 5a69c05516cc3ad1e823422f5ffbb18f2f06fdb3 Mon Sep 17 00:00:00 2001 From: Bryan Frimin Date: Wed, 29 Oct 2025 20:31:04 +0100 Subject: [PATCH] Fix no iteration over all saml attr Signed-off-by: Bryan Frimin --- pkg/auth/saml_mapper.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/auth/saml_mapper.go b/pkg/auth/saml_mapper.go index 1aa69b558..f162e4531 100644 --- a/pkg/auth/saml_mapper.go +++ b/pkg/auth/saml_mapper.go @@ -26,12 +26,14 @@ func ExtractAttributeValue(assertion *saml.Assertion, attributeName string) (str return "", fmt.Errorf("no attribute statement in assertion") } - for _, attr := range assertion.AttributeStatements[0].Attributes { - if attr.Name == attributeName { - if len(attr.Values) == 0 { - return "", fmt.Errorf("attribute %q has no values", attributeName) + for _, statement := range assertion.AttributeStatements { + for _, attr := range statement.Attributes { + if attr.Name == attributeName { + if len(attr.Values) == 0 { + return "", fmt.Errorf("attribute %q has no values", attributeName) + } + return attr.Values[0].Value, nil } - return attr.Values[0].Value, nil } }