Skip to content

Commit 0810042

Browse files
committed
Merge pull request #319 from vincentwoo/formatting
format a couple difficult to read things in xml_security.rb
2 parents df0cdba + 22b0ba5 commit 0810042

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

lib/xml_security.rb

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,13 @@ def canon_algorithm(element)
4949

5050
case algorithm
5151
when "http://www.w3.org/TR/2001/REC-xml-c14n-20010315",
52-
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments" then Nokogiri::XML::XML_C14N_1_0
52+
"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"
53+
Nokogiri::XML::XML_C14N_1_0
5354
when "http://www.w3.org/2006/12/xml-c14n11",
54-
"http://www.w3.org/2006/12/xml-c14n11#WithComments" then Nokogiri::XML::XML_C14N_1_1
55-
else Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0
55+
"http://www.w3.org/2006/12/xml-c14n11#WithComments"
56+
Nokogiri::XML::XML_C14N_1_1
57+
else
58+
Nokogiri::XML::XML_C14N_EXCLUSIVE_1_0
5659
end
5760
end
5861

@@ -76,10 +79,10 @@ def algorithm(element)
7679
end
7780

7881
class Document < BaseDocument
79-
RSA_SHA1 = "http://www.w3.org/2000/09/xmldsig#rsa-sha1"
80-
RSA_SHA256 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"
81-
RSA_SHA384 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384"
82-
RSA_SHA512 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"
82+
RSA_SHA1 = "http://www.w3.org/2000/09/xmldsig#rsa-sha1"
83+
RSA_SHA256 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"
84+
RSA_SHA384 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384"
85+
RSA_SHA512 = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512"
8386
SHA1 = "http://www.w3.org/2000/09/xmldsig#sha1"
8487
SHA256 = "http://www.w3.org/2001/04/xmldsig-more#sha256"
8588
SHA384 = "http://www.w3.org/2001/04/xmldsig-more#sha384"
@@ -202,7 +205,7 @@ def validate_document(idp_cert_fingerprint, soft = true, options = {})
202205
{ "ds"=>DSIG }
203206
)
204207

205-
if cert_element
208+
if cert_element
206209
base64_cert = cert_element.text
207210
cert_text = Base64.decode64(base64_cert)
208211
cert = OpenSSL::X509::Certificate.new(cert_text)
@@ -227,7 +230,7 @@ def validate_document(idp_cert_fingerprint, soft = true, options = {})
227230
return false
228231
else
229232
raise OneLogin::RubySaml::ValidationError.new("Certificate element missing in response (ds:X509Certificate) and not cert provided at settings")
230-
end
233+
end
231234
end
232235
end
233236
validate_signature(base64_cert, soft)
@@ -346,7 +349,7 @@ def extract_signed_element_id
346349

347350
return nil if reference_element.nil?
348351

349-
sei = reference_element.attribute("URI").value[1..-1]
352+
sei = reference_element.attribute("URI").value[1..-1]
350353
sei.nil? ? self.root.attribute("ID") : sei
351354
end
352355

0 commit comments

Comments
 (0)