@@ -11,31 +11,31 @@ class XmlSecurityTest < Test::Unit::TestCase
1111 end
1212
1313 should "should run validate without throwing NS related exceptions" do
14- assert !@document . validate_doc ( @base64cert , true )
14+ assert !@document . validate_signature ( @base64cert , true )
1515 end
1616
1717 should "should run validate with throwing NS related exceptions" do
1818 assert_raise ( Onelogin ::Saml ::ValidationError ) do
19- @document . validate_doc ( @base64cert , false )
19+ @document . validate_signature ( @base64cert , false )
2020 end
2121 end
22-
22+
2323 should "not raise an error when softly validating the document multiple times" do
2424 assert_nothing_raised do
25- 2 . times { @document . validate_doc ( @base64cert , true ) }
25+ 2 . times { @document . validate_signature ( @base64cert , true ) }
2626 end
2727 end
2828
2929 should "should raise Fingerprint mismatch" do
3030 exception = assert_raise ( Onelogin ::Saml ::ValidationError ) do
31- @document . validate ( "no:fi:ng:er:pr:in:t" , false )
31+ @document . validate_document ( "no:fi:ng:er:pr:in:t" , false )
3232 end
3333 assert_equal ( "Fingerprint mismatch" , exception . message )
3434 end
3535
3636 should "should raise Digest mismatch" do
3737 exception = assert_raise ( Onelogin ::Saml ::ValidationError ) do
38- @document . validate_doc ( @base64cert , false )
38+ @document . validate_signature ( @base64cert , false )
3939 end
4040 assert_equal ( "Digest mismatch" , exception . message )
4141 end
@@ -47,7 +47,7 @@ class XmlSecurityTest < Test::Unit::TestCase
4747 document = XMLSecurity ::SignedDocument . new ( response )
4848 base64cert = document . elements [ "//ds:X509Certificate" ] . text
4949 exception = assert_raise ( Onelogin ::Saml ::ValidationError ) do
50- document . validate_doc ( base64cert , false )
50+ document . validate_signature ( base64cert , false )
5151 end
5252 assert_equal ( "Key validation error" , exception . message )
5353 end
@@ -57,7 +57,7 @@ class XmlSecurityTest < Test::Unit::TestCase
5757 response . sub! ( /<ds:X509Certificate>.*<\/ ds:X509Certificate>/ , "" )
5858 document = XMLSecurity ::SignedDocument . new ( response )
5959 exception = assert_raise ( Onelogin ::Saml ::ValidationError ) do
60- document . validate ( "a fingerprint" , false ) # The fingerprint isn't relevant to this test
60+ document . validate_document ( "a fingerprint" , false ) # The fingerprint isn't relevant to this test
6161 end
6262 assert_equal ( "Certificate element missing in response (ds:X509Certificate)" , exception . message )
6363 end
@@ -66,41 +66,41 @@ class XmlSecurityTest < Test::Unit::TestCase
6666 context "Algorithms" do
6767 should "validate using SHA1" do
6868 @document = XMLSecurity ::SignedDocument . new ( fixture ( :adfs_response_sha1 , false ) )
69- assert @document . validate ( "F1:3C:6B:80:90:5A:03:0E:6C:91:3E:5D:15:FA:DD:B0:16:45:48:72" )
69+ assert @document . validate_document ( "F1:3C:6B:80:90:5A:03:0E:6C:91:3E:5D:15:FA:DD:B0:16:45:48:72" )
7070 end
7171
7272 should "validate using SHA256" do
7373 @document = XMLSecurity ::SignedDocument . new ( fixture ( :adfs_response_sha256 , false ) )
74- assert @document . validate ( "28:74:9B:E8:1F:E8:10:9C:A8:7C:A9:C3:E3:C5:01:6C:92:1C:B4:BA" )
74+ assert @document . validate_document ( "28:74:9B:E8:1F:E8:10:9C:A8:7C:A9:C3:E3:C5:01:6C:92:1C:B4:BA" )
7575 end
7676
7777 should "validate using SHA384" do
7878 @document = XMLSecurity ::SignedDocument . new ( fixture ( :adfs_response_sha384 , false ) )
79- assert @document . validate ( "F1:3C:6B:80:90:5A:03:0E:6C:91:3E:5D:15:FA:DD:B0:16:45:48:72" )
79+ assert @document . validate_document ( "F1:3C:6B:80:90:5A:03:0E:6C:91:3E:5D:15:FA:DD:B0:16:45:48:72" )
8080 end
8181
8282 should "validate using SHA512" do
8383 @document = XMLSecurity ::SignedDocument . new ( fixture ( :adfs_response_sha512 , false ) )
84- assert @document . validate ( "F1:3C:6B:80:90:5A:03:0E:6C:91:3E:5D:15:FA:DD:B0:16:45:48:72" )
84+ assert @document . validate_document ( "F1:3C:6B:80:90:5A:03:0E:6C:91:3E:5D:15:FA:DD:B0:16:45:48:72" )
8585 end
8686 end
87-
87+
8888 context "XmlSecurity::SignedDocument" do
89-
89+
9090 context "#extract_inclusive_namespaces" do
9191 should "support explicit namespace resolution for exclusive canonicalization" do
9292 response = fixture ( :open_saml_response , false )
9393 document = XMLSecurity ::SignedDocument . new ( response )
9494 inclusive_namespaces = document . send ( :extract_inclusive_namespaces )
95-
95+
9696 assert_equal %w[ xs ] , inclusive_namespaces
9797 end
98-
98+
9999 should "support implicit namespace resolution for exclusive canonicalization" do
100100 response = fixture ( :no_signature_ns , false )
101101 document = XMLSecurity ::SignedDocument . new ( response )
102102 inclusive_namespaces = document . send ( :extract_inclusive_namespaces )
103-
103+
104104 assert_equal %w[ #default saml ds xs xsi ] , inclusive_namespaces
105105 end
106106
@@ -120,10 +120,10 @@ class XmlSecurityTest < Test::Unit::TestCase
120120 should "return an empty list when inclusive namespace element is missing" do
121121 response = fixture ( :no_signature_ns , false )
122122 response . slice! %r{<InclusiveNamespaces xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="#default saml ds xs xsi"/>}
123-
123+
124124 document = XMLSecurity ::SignedDocument . new ( response )
125125 inclusive_namespaces = document . send ( :extract_inclusive_namespaces )
126-
126+
127127 assert inclusive_namespaces . empty?
128128 end
129129 end
@@ -156,5 +156,5 @@ class XmlSecurityTest < Test::Unit::TestCase
156156 end
157157
158158 end
159-
159+
160160end
0 commit comments