Skip to content

Commit 2e17945

Browse files
committed
first attempt at adding support for scoped attributes
needs additional work and tests
1 parent 6ac048b commit 2e17945

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lib/onelogin/ruby-saml/response.rb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def name_id
9494

9595
alias_method :nameid, :name_id
9696

97+
9798
# Gets the SessionIndex from the AuthnStatement.
9899
# Could be used to be stored in the local session in order
99100
# to be used in a future Logout Request that the SP could
@@ -131,12 +132,18 @@ def attributes
131132
stmt_element.elements.each do |attr_element|
132133
name = attr_element.attributes["Name"]
133134
values = attr_element.elements.collect{|e|
134-
# SAMLCore requires that nil AttributeValues MUST contain xsi:nil XML attribute set to "true" or "1"
135-
# otherwise the value is to be regarded as empty.
136-
["true", "1"].include?(e.attributes['xsi:nil']) ? nil : e.text.to_s
135+
if (e.elements.nil? || e.elements.size == 0)
136+
# SAMLCore requires that nil AttributeValues MUST contain xsi:nil XML attribute set to "true" or "1"
137+
# otherwise the value is to be regarded as empty.
138+
["true", "1"].include?(e.attributes['xsi:nil']) ? nil : e.text.to_s
139+
else
140+
e.elements.collect{|f|
141+
["true", "1"].include?(f.attributes['xsi:nil']) ? nil : f.attributes['NameQualifier']+"/"+f.text.to_s
142+
}
143+
end
137144
}
138145

139-
attributes.add(name, values)
146+
attributes.add(name, values.flatten)
140147
end
141148

142149
attributes

0 commit comments

Comments
 (0)