Skip to content

Merge repeated same response attributes into one slice #241

Description

@mitar

Currently if there are repeated same attributes (not their values) in the response, the last one just overrides the previous ones. This library supports only if there are multiple values inside one attribute. I think it would be better to make sure no data is lost with strange SAML implementations to flatten and marge them all into one output slice, pretending like they were just values inside one attribute.

Currently it is in retrieve_assertion.go:

		for _, attribute := range attributeStatement.Attributes {
			assertionInfo.Values[attribute.Name] = attribute
		}

I think something like this would be better:

		for _, attribute := range attributeStatement.Attributes {
			if v, ok := assertionInfo.Values[attribute.Name]; ok {
				v.Values = append(v.Values, attribute.Values...)
				assertionInfo.Values[attribute.Name] = v
			} else {
				assertionInfo.Values[attribute.Name] = attribute
			}
		}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions