Fix no iteration over all saml attr
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -26,7 +26,8 @@ func ExtractAttributeValue(assertion *saml.Assertion, attributeName string) (str
|
|||||||
return "", fmt.Errorf("no attribute statement in assertion")
|
return "", fmt.Errorf("no attribute statement in assertion")
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, attr := range assertion.AttributeStatements[0].Attributes {
|
for _, statement := range assertion.AttributeStatements {
|
||||||
|
for _, attr := range statement.Attributes {
|
||||||
if attr.Name == attributeName {
|
if attr.Name == attributeName {
|
||||||
if len(attr.Values) == 0 {
|
if len(attr.Values) == 0 {
|
||||||
return "", fmt.Errorf("attribute %q has no values", attributeName)
|
return "", fmt.Errorf("attribute %q has no values", attributeName)
|
||||||
@@ -34,6 +35,7 @@ func ExtractAttributeValue(assertion *saml.Assertion, attributeName string) (str
|
|||||||
return attr.Values[0].Value, nil
|
return attr.Values[0].Value, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return "", fmt.Errorf("attribute %q not found in assertion", attributeName)
|
return "", fmt.Errorf("attribute %q not found in assertion", attributeName)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user