lib/saml2/response.rb in saml2-1.1.5 vs lib/saml2/response.rb in saml2-2.0.0

- old
+ new

@@ -55,10 +55,22 @@ def initialize super @assertions = [] end + def from_xml(node) + super + remove_instance_variable(:@assertions) + end + + def assertions + unless instance_variable_defined?(:@assertions) + @assertions = load_object_array(xml, 'saml:Assertion', Assertion) + end + @assertions + end + def sign(*args) assertions.each { |assertion| assertion.sign(*args) } end private @@ -69,10 +81,13 @@ 'xmlns:saml' => Namespaces::SAML ) do |response| super(response) assertions.each do |assertion| - response.parent << assertion.to_xml + # we can't just call build, because it may already + # be signed as a separate message, so call to_xml to + # get the cached signed result + response.parent << assertion.to_xml.root end end end end end