@@ -73,6 +73,40 @@ class SloLogoutresponseTest < Minitest::Test
7373 settings . security [ :embed_sign ] = true
7474 end
7575
76+ it "doesn't sign through create_xml_document" do
77+ unauth_res = OneLogin ::RubySaml ::SloLogoutresponse . new
78+ inflated = unauth_res . create_xml_document ( settings ) . to_s
79+
80+ refute_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>] , inflated
81+ refute_match %r[<ds:SignatureMethod Algorithm='http://www.w3.org/2000/09/xmldsig#rsa-sha1'/>] , inflated
82+ refute_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2000/09/xmldsig#sha1'/>] , inflated
83+ end
84+
85+ it "sign unsigned request" do
86+ unauth_res = OneLogin ::RubySaml ::SloLogoutresponse . new
87+ unauth_res_doc = unauth_res . create_xml_document ( settings )
88+ inflated = unauth_res_doc . to_s
89+
90+ refute_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>] , inflated
91+ refute_match %r[<ds:SignatureMethod Algorithm='http://www.w3.org/2000/09/xmldsig#rsa-sha1'/>] , inflated
92+ refute_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2000/09/xmldsig#sha1'/>] , inflated
93+
94+ inflated = unauth_res . sign_document ( unauth_res_doc , settings ) . to_s
95+
96+ assert_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>] , inflated
97+ assert_match %r[<ds:SignatureMethod Algorithm='http://www.w3.org/2000/09/xmldsig#rsa-sha1'/>] , inflated
98+ assert_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2000/09/xmldsig#sha1'/>] , inflated
99+ end
100+
101+ it "signs through create_logout_response_xml_doc" do
102+ unauth_res = OneLogin ::RubySaml ::SloLogoutresponse . new
103+ inflated = unauth_res . create_logout_response_xml_doc ( settings ) . to_s
104+
105+ assert_match %r[<ds:SignatureValue>([a-zA-Z0-9/+=]+)</ds:SignatureValue>] , inflated
106+ assert_match %r[<ds:SignatureMethod Algorithm='http://www.w3.org/2000/09/xmldsig#rsa-sha1'/>] , inflated
107+ assert_match %r[<ds:DigestMethod Algorithm='http://www.w3.org/2000/09/xmldsig#sha1'/>] , inflated
108+ end
109+
76110 it "create a signed logout response" do
77111 logout_request . settings = settings
78112 params = OneLogin ::RubySaml ::SloLogoutresponse . new . create_params ( settings , logout_request . id , "Custom Logout Message" )
0 commit comments