Skip to content

Instantly share code, notes, and snippets.

@eccegordo
Created March 13, 2013 23:27
Show Gist options
  • Save eccegordo/5157473 to your computer and use it in GitHub Desktop.
Save eccegordo/5157473 to your computer and use it in GitHub Desktop.
fix for ruby saml Enable multiple attributes in SAML XML
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