@@ -36,7 +36,7 @@ class AuthrequestTest < Minitest::Test
3636 zstream . finish
3737 zstream . close
3838
39- assert_match ( /<samlp:AuthnRequest[^<]* Destination=' http:\/ \/ example.com' / , inflated )
39+ assert_match ( /<samlp:AuthnRequest[^<]* Destination=" http:\/ \/ example\ . com" / , inflated )
4040 end
4141
4242 it "create the SAMLRequest URL parameter without deflating" do
@@ -61,7 +61,7 @@ class AuthrequestTest < Minitest::Test
6161 zstream . finish
6262 zstream . close
6363
64- assert_match ( /<samlp:AuthnRequest[^<]* IsPassive=' true' / , inflated )
64+ assert_match ( /<samlp:AuthnRequest[^<]* IsPassive=" true" / , inflated )
6565 end
6666
6767 it "create the SAMLRequest URL parameter with ProtocolBinding" do
@@ -76,7 +76,7 @@ class AuthrequestTest < Minitest::Test
7676 zstream . finish
7777 zstream . close
7878
79- assert_match ( /<samlp:AuthnRequest[^<]* ProtocolBinding=' urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST' / , inflated )
79+ assert_match ( /<samlp:AuthnRequest[^<]* ProtocolBinding=" urn:oasis:names:tc:SAML:2\ . 0:bindings:HTTP-POST" / , inflated )
8080 end
8181
8282 it "create the SAMLRequest URL parameter with AttributeConsumingServiceIndex" do
@@ -90,7 +90,7 @@ class AuthrequestTest < Minitest::Test
9090 inflated = zstream . inflate ( decoded )
9191 zstream . finish
9292 zstream . close
93- assert_match ( /<samlp:AuthnRequest[^<]* AttributeConsumingServiceIndex='30' / , inflated )
93+ assert_match ( /<samlp:AuthnRequest[^<]* AttributeConsumingServiceIndex="30" / , inflated )
9494 end
9595
9696 it "create the SAMLRequest URL parameter with ForceAuthn" do
@@ -104,7 +104,7 @@ class AuthrequestTest < Minitest::Test
104104 inflated = zstream . inflate ( decoded )
105105 zstream . finish
106106 zstream . close
107- assert_match ( /<samlp:AuthnRequest[^<]* ForceAuthn=' true' / , inflated )
107+ assert_match ( /<samlp:AuthnRequest[^<]* ForceAuthn=" true" / , inflated )
108108 end
109109
110110 it "create the SAMLRequest URL parameter with NameID Format" do
@@ -118,8 +118,8 @@ class AuthrequestTest < Minitest::Test
118118 zstream . finish
119119 zstream . close
120120
121- assert_match ( /<samlp:NameIDPolicy[^<]* AllowCreate=' true' / , inflated )
122- assert_match ( /<samlp:NameIDPolicy[^<]* Format=' urn:oasis:names:tc:SAML:2.0:nameid-format:transient' / , inflated )
121+ assert_match ( /<samlp:NameIDPolicy[^<]* AllowCreate=" true" / , inflated )
122+ assert_match ( /<samlp:NameIDPolicy[^<]* Format=" urn:oasis:names:tc:SAML:2\ . 0:nameid-format:transient" / , inflated )
123123 end
124124
125125 it "create the SAMLRequest URL parameter with Subject" do
@@ -135,8 +135,8 @@ class AuthrequestTest < Minitest::Test
135135 zstream . close
136136
137137 assert inflated . include? ( '<saml:Subject>' )
138- assert inflated . include? ( " <saml:NameID Format=' urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress' >testuser@example.com</saml:NameID>" )
139- assert inflated . include? ( " <saml:SubjectConfirmation Method=' urn:oasis:names:tc:SAML:2.0:cm:bearer'/>" )
138+ assert inflated . include? ( ' <saml:NameID Format=" urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress" >testuser@example.com</saml:NameID>' )
139+ assert inflated . include? ( ' <saml:SubjectConfirmation Method=" urn:oasis:names:tc:SAML:2.0:cm:bearer"/>' )
140140 end
141141
142142 it "accept extra parameters" do
@@ -199,9 +199,9 @@ class AuthrequestTest < Minitest::Test
199199
200200 it "can mutate the uuid" do
201201 request = RubySaml ::Authrequest . new
202- request_id = request . request_id
203202 assert_nil request . uuid
204- assert_nil request_id
203+ assert_nil request . request_id
204+
205205 request . uuid = "new_uuid"
206206 assert_equal "new_uuid" , request . uuid
207207 assert_equal request . uuid , request . request_id
@@ -225,7 +225,7 @@ class AuthrequestTest < Minitest::Test
225225 it "create the SAMLRequest parameter correctly" do
226226
227227 auth_url = RubySaml ::Authrequest . new . create ( settings )
228- assert_match ( /^http:\/ \/ example.com\? SAMLRequest/ , auth_url )
228+ assert_match ( /^http:\/ \/ example\ . com\? SAMLRequest/ , auth_url )
229229 end
230230 end
231231
@@ -234,7 +234,7 @@ class AuthrequestTest < Minitest::Test
234234 settings . idp_sso_service_url = "http://example.com?field=value"
235235
236236 auth_url = RubySaml ::Authrequest . new . create ( settings )
237- assert_match ( /^http:\/ \/ example.com\? field=value&SAMLRequest/ , auth_url )
237+ assert_match ( /^http:\/ \/ example\ . com\? field=value&SAMLRequest/ , auth_url )
238238 end
239239 end
240240
@@ -254,22 +254,22 @@ class AuthrequestTest < Minitest::Test
254254 it "create the saml:AuthnContextClassRef with comparison exact" do
255255 settings . authn_context = 'secure/name/password/uri'
256256 auth_doc = RubySaml ::Authrequest . new . create_authentication_xml_doc ( settings )
257- assert_match ( /<samlp:RequestedAuthnContext[\S ]+Comparison=' exact' / , auth_doc . to_s )
257+ assert_match ( /<samlp:RequestedAuthnContext[\S ]+Comparison=" exact" / , auth_doc . to_s )
258258 assert_match ( /<saml:AuthnContextClassRef>secure\/ name\/ password\/ uri<\/ saml:AuthnContextClassRef>/ , auth_doc . to_s )
259259 end
260260
261261 it "create the saml:AuthnContextClassRef with comparison minimun" do
262262 settings . authn_context = 'secure/name/password/uri'
263263 settings . authn_context_comparison = 'minimun'
264264 auth_doc = RubySaml ::Authrequest . new . create_authentication_xml_doc ( settings )
265- assert_match ( /<samlp:RequestedAuthnContext[\S ]+Comparison=' minimun' / , auth_doc . to_s )
265+ assert_match ( /<samlp:RequestedAuthnContext[\S ]+Comparison=" minimun" / , auth_doc . to_s )
266266 assert_match ( /<saml:AuthnContextClassRef>secure\/ name\/ password\/ uri<\/ saml:AuthnContextClassRef>/ , auth_doc . to_s )
267267 end
268268
269269 it "create the saml:AuthnContextDeclRef element correctly" do
270270 settings . authn_context_decl_ref = 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport'
271271 auth_doc = RubySaml ::Authrequest . new . create_authentication_xml_doc ( settings )
272- assert_match ( /<saml:AuthnContextDeclRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport<\/ saml:AuthnContextDeclRef>/ , auth_doc . to_s )
272+ assert_match ( /<saml:AuthnContextDeclRef>urn:oasis:names:tc:SAML:2\ . 0:ac:classes:PasswordProtectedTransport<\/ saml:AuthnContextDeclRef>/ , auth_doc . to_s )
273273 end
274274
275275 it "create the saml:AuthnContextClassRef element correctly" do
@@ -281,22 +281,22 @@ class AuthrequestTest < Minitest::Test
281281 it "create the saml:AuthnContextClassRef with comparison exact" do
282282 settings . authn_context = 'secure/name/password/uri'
283283 auth_doc = RubySaml ::Authrequest . new . create_authentication_xml_doc ( settings )
284- assert auth_doc . to_s =~ /<samlp:RequestedAuthnContext[\S ]+Comparison=' exact' /
284+ assert auth_doc . to_s =~ /<samlp:RequestedAuthnContext[\S ]+Comparison=" exact" /
285285 assert auth_doc . to_s =~ /<saml:AuthnContextClassRef>secure\/ name\/ password\/ uri<\/ saml:AuthnContextClassRef>/
286286 end
287287
288288 it "create the saml:AuthnContextClassRef with comparison minimun" do
289289 settings . authn_context = 'secure/name/password/uri'
290290 settings . authn_context_comparison = 'minimun'
291291 auth_doc = RubySaml ::Authrequest . new . create_authentication_xml_doc ( settings )
292- assert auth_doc . to_s =~ /<samlp:RequestedAuthnContext[\S ]+Comparison=' minimun' /
292+ assert auth_doc . to_s =~ /<samlp:RequestedAuthnContext[\S ]+Comparison=" minimun" /
293293 assert auth_doc . to_s =~ /<saml:AuthnContextClassRef>secure\/ name\/ password\/ uri<\/ saml:AuthnContextClassRef>/
294294 end
295295
296296 it "create the saml:AuthnContextDeclRef element correctly" do
297297 settings . authn_context_decl_ref = 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport'
298298 auth_doc = RubySaml ::Authrequest . new . create_authentication_xml_doc ( settings )
299- assert auth_doc . to_s =~ /<saml:AuthnContextDeclRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport<\/ saml:AuthnContextDeclRef>/
299+ assert auth_doc . to_s =~ /<saml:AuthnContextDeclRef>urn:oasis:names:tc:SAML:2\ . 0:ac:classes:PasswordProtectedTransport<\/ saml:AuthnContextDeclRef>/
300300 end
301301
302302 it "create multiple saml:AuthnContextDeclRef elements correctly " do
@@ -329,7 +329,7 @@ class AuthrequestTest < Minitest::Test
329329 unless sp_hash_algo == :sha256
330330 it 'using mixed signature and digest methods (signature SHA256)' do
331331 # RSA is ignored here; only the hash sp_key_algo is used
332- settings . security [ :signature_method ] = RubySaml ::XML ::Document ::RSA_SHA256
332+ settings . security [ :signature_method ] = RubySaml ::XML ::Crypto ::RSA_SHA256
333333 params = RubySaml ::Authrequest . new . create_params ( settings )
334334 request_xml = Base64 . decode64 ( params [ "SAMLRequest" ] )
335335
@@ -339,7 +339,7 @@ class AuthrequestTest < Minitest::Test
339339 end
340340
341341 it 'using mixed signature and digest methods (digest SHA256)' do
342- settings . security [ :digest_method ] = RubySaml ::XML ::Document ::SHA256
342+ settings . security [ :digest_method ] = RubySaml ::XML ::Crypto ::SHA256
343343 params = RubySaml ::Authrequest . new . create_params ( settings )
344344 request_xml = Base64 . decode64 ( params [ "SAMLRequest" ] )
345345
@@ -428,7 +428,7 @@ class AuthrequestTest < Minitest::Test
428428 unless sp_hash_algo == :sha256
429429 it 'using mixed signature and digest methods (signature SHA256)' do
430430 # RSA is ignored here; only the hash sp_key_algo is used
431- settings . security [ :signature_method ] = RubySaml ::XML ::Document ::RSA_SHA256
431+ settings . security [ :signature_method ] = RubySaml ::XML ::Crypto ::RSA_SHA256
432432 params = RubySaml ::Authrequest . new . create_params ( settings , :RelayState => 'http://example.com' )
433433
434434 assert params [ 'SAMLRequest' ]
@@ -444,7 +444,7 @@ class AuthrequestTest < Minitest::Test
444444 end
445445
446446 it 'using mixed signature and digest methods (digest SHA256)' do
447- settings . security [ :digest_method ] = RubySaml ::XML ::Document ::SHA256
447+ settings . security [ :digest_method ] = RubySaml ::XML ::Crypto ::SHA256
448448 params = RubySaml ::Authrequest . new . create_params ( settings , :RelayState => 'http://example.com' )
449449
450450 assert params [ 'SAMLRequest' ]
@@ -461,7 +461,7 @@ class AuthrequestTest < Minitest::Test
461461 end
462462
463463 it "create a signature parameter using the first certificate and key" do
464- settings . security [ :signature_method ] = RubySaml ::XML ::Document ::RSA_SHA1
464+ settings . security [ :signature_method ] = RubySaml ::XML ::Crypto ::RSA_SHA1
465465 settings . certificate = nil
466466 settings . private_key = nil
467467 cert , pkey = CertificateHelper . generate_pair ( sp_key_algo )
0 commit comments