Commit 2705813
Changed files (2)
lib
saml
lib/saml/kit/document.rb
@@ -86,12 +86,15 @@ module Saml
# @param xml [String] the raw xml string.
# @param configuration [Saml::Kit::Configuration] the configuration to use for unpacking the document.
def to_saml_document(xml, configuration: Saml::Kit.configuration)
+ xml_document = ::Xml::Kit::Xml.new(xml, namespaces: {
+ "samlp": ::Saml::Kit::Namespaces::PROTOCOL
+ })
constructor = {
"AuthnRequest" => Saml::Kit::AuthenticationRequest,
"LogoutRequest" => Saml::Kit::LogoutRequest,
"LogoutResponse" => Saml::Kit::LogoutResponse,
"Response" => Saml::Kit::Response,
- }[::Xml::Kit::Xml.new(xml, namespaces: { "samlp": ::Saml::Kit::Namespaces::PROTOCOL }).find_by(XPATH).name] || InvalidDocument
+ }[xml_document.find_by(XPATH).name] || InvalidDocument
constructor.new(xml, configuration: configuration)
rescue => error
Saml::Kit.logger.error(error)
lib/saml/kit/signature.rb
@@ -9,7 +9,7 @@ module Saml
def certificate
value = to_h.fetch('KeyInfo', {}).fetch('X509Data', {}).fetch('X509Certificate', nil)
return if value.nil?
- Xml::Kit::Certificate.new(value, use: :signing)
+ ::Xml::Kit::Certificate.new(value, use: :signing)
end
# Returns true when the fingerprint of the certificate matches one of the certificates registered in the metadata.