Created
March 13, 2013 23:27
-
-
Save eccegordo/5157473 to your computer and use it in GitHub Desktop.
fix for ruby saml
Enable multiple attributes in SAML XML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def attributes | |
@attr_statements ||= begin | |
result = {} | |
stmt_element = xpath_first_from_signed_assertion('/a:AttributeStatement') | |
return {} if stmt_element.nil? | |
stmt_element.elements.each do |attr_element| | |
name = attr_element.attributes["Name"] | |
value = attr_element.elements.map { |e| e.text } | |
if value.size == 1 | |
result[name] = value.first | |
else | |
result[name] = value | |
end | |
end | |
result.keys.each do |key| | |
result[key.intern] = result[key] | |
end | |
result | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment