@@ -104,6 +104,24 @@ class RequestTest < Minitest::Test
104
104
settings . private_key = ruby_saml_key_text
105
105
end
106
106
107
+ it "doens't sign through create_xml_document" do
108
+ unauth_req = OneLogin ::RubySaml ::Logoutrequest . new
109
+ inflated = unauth_req . create_xml_document ( settings ) . to_s
110
+
111
+ refute_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>] , inflated
112
+ refute_match %r[<ds:SignatureMethod Algorithm='http://www.w3.org/2000/09/xmldsig#rsa-sha1'/>] , inflated
113
+ refute_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2000/09/xmldsig#sha1'/>] , inflated
114
+ end
115
+
116
+ it "signs through create_logout_request_xml_doc" do
117
+ unauth_req = OneLogin ::RubySaml ::Logoutrequest . new
118
+ inflated = unauth_req . create_logout_request_xml_doc ( settings ) . to_s
119
+
120
+ assert_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>] , inflated
121
+ assert_match %r[<ds:SignatureMethod Algorithm='http://www.w3.org/2000/09/xmldsig#rsa-sha1'/>] , inflated
122
+ assert_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2000/09/xmldsig#sha1'/>] , inflated
123
+ end
124
+
107
125
it "created a signed logout request" do
108
126
settings . compress_request = true
109
127
@@ -185,8 +203,8 @@ class RequestTest < Minitest::Test
185
203
query_string << "&SigAlg=#{ CGI . escape ( params [ 'SigAlg' ] ) } "
186
204
187
205
signature_algorithm = XMLSecurity ::BaseDocument . new . algorithm ( params [ 'SigAlg' ] )
188
- assert_equal signature_algorithm , OpenSSL ::Digest ::SHA256
189
- assert cert . public_key . verify ( signature_algorithm . new , Base64 . decode64 ( params [ 'Signature' ] ) , query_string )
206
+ assert_equal signature_algorithm , OpenSSL ::Digest ::SHA256
207
+ assert cert . public_key . verify ( signature_algorithm . new , Base64 . decode64 ( params [ 'Signature' ] ) , query_string )
190
208
end
191
209
192
210
it "create a signature parameter with RSA_SHA384 / SHA384 and validate it" do
@@ -201,8 +219,8 @@ class RequestTest < Minitest::Test
201
219
query_string << "&SigAlg=#{ CGI . escape ( params [ 'SigAlg' ] ) } "
202
220
203
221
signature_algorithm = XMLSecurity ::BaseDocument . new . algorithm ( params [ 'SigAlg' ] )
204
- assert_equal signature_algorithm , OpenSSL ::Digest ::SHA384
205
- assert cert . public_key . verify ( signature_algorithm . new , Base64 . decode64 ( params [ 'Signature' ] ) , query_string )
222
+ assert_equal signature_algorithm , OpenSSL ::Digest ::SHA384
223
+ assert cert . public_key . verify ( signature_algorithm . new , Base64 . decode64 ( params [ 'Signature' ] ) , query_string )
206
224
end
207
225
208
226
it "create a signature parameter with RSA_SHA512 / SHA512 and validate it" do
@@ -217,8 +235,8 @@ class RequestTest < Minitest::Test
217
235
query_string << "&SigAlg=#{ CGI . escape ( params [ 'SigAlg' ] ) } "
218
236
219
237
signature_algorithm = XMLSecurity ::BaseDocument . new . algorithm ( params [ 'SigAlg' ] )
220
- assert_equal signature_algorithm , OpenSSL ::Digest ::SHA512
221
- assert cert . public_key . verify ( signature_algorithm . new , Base64 . decode64 ( params [ 'Signature' ] ) , query_string )
238
+ assert_equal signature_algorithm , OpenSSL ::Digest ::SHA512
239
+ assert cert . public_key . verify ( signature_algorithm . new , Base64 . decode64 ( params [ 'Signature' ] ) , query_string )
222
240
end
223
241
224
242
end
0 commit comments