lib/saml/util.rb in libsaml-3.2.3 vs lib/saml/util.rb in libsaml-3.3.0

- old
+ new

@@ -113,10 +113,13 @@ def verify_xml(message, raw_body) document = Xmldsig::SignedDocument.new(raw_body) signature_valid = document.validate do |signature, data, signature_algorithm| - message.provider.verify(signature_algorithm, signature, data, message.signature.key_name) + node = document.signatures.find { |s| s.signature_value == signature }.signature.at_xpath('descendant::ds:KeyName', Xmldsig::NAMESPACES) + key_name = node.present? ? node.content : nil + + message.provider.verify(signature_algorithm, signature, data, key_name) end fail Saml::Errors::SignatureInvalid unless signature_valid signed_node = document.signed_nodes.find { |node| node['ID'] == message._id }