@@ -14,7 +14,7 @@ class RequestTest < Minitest::Test
1414
1515 it "create the deflated SAMLRequest URL parameter" do
1616 auth_url = OneLogin ::RubySaml ::Authrequest . new . create ( settings )
17- assert_match /^http:\/ \/ example\. com\? SAMLRequest=/ , auth_url
17+ assert_match ( /^http:\/ \/ example\. com\? SAMLRequest=/ , auth_url )
1818 payload = CGI . unescape ( auth_url . split ( "=" ) . last )
1919 decoded = Base64 . decode64 ( payload )
2020
@@ -23,7 +23,7 @@ class RequestTest < Minitest::Test
2323 zstream . finish
2424 zstream . close
2525
26- assert_match /^<samlp:AuthnRequest/ , inflated
26+ assert_match ( /^<samlp:AuthnRequest/ , inflated )
2727 end
2828
2929 it "create the deflated SAMLRequest URL parameter including the Destination" do
@@ -36,23 +36,23 @@ class RequestTest < 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
4343 settings . compress_request = false
4444 auth_url = OneLogin ::RubySaml ::Authrequest . new . create ( settings )
45- assert_match /^http:\/ \/ example\. com\? SAMLRequest=/ , auth_url
45+ assert_match ( /^http:\/ \/ example\. com\? SAMLRequest=/ , auth_url )
4646 payload = CGI . unescape ( auth_url . split ( "=" ) . last )
4747 decoded = Base64 . decode64 ( payload )
4848
49- assert_match /^<samlp:AuthnRequest/ , decoded
49+ assert_match ( /^<samlp:AuthnRequest/ , decoded )
5050 end
5151
5252 it "create the SAMLRequest URL parameter with IsPassive" do
5353 settings . passive = true
5454 auth_url = OneLogin ::RubySaml ::Authrequest . new . create ( settings )
55- assert_match /^http:\/ \/ example\. com\? SAMLRequest=/ , auth_url
55+ assert_match ( /^http:\/ \/ example\. com\? SAMLRequest=/ , auth_url )
5656 payload = CGI . unescape ( auth_url . split ( "=" ) . last )
5757 decoded = Base64 . decode64 ( payload )
5858
@@ -61,13 +61,13 @@ class RequestTest < 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
6868 settings . protocol_binding = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST'
6969 auth_url = OneLogin ::RubySaml ::Authrequest . new . create ( settings )
70- assert_match /^http:\/ \/ example\. com\? SAMLRequest=/ , auth_url
70+ assert_match ( /^http:\/ \/ example\. com\? SAMLRequest=/ , auth_url )
7171 payload = CGI . unescape ( auth_url . split ( "=" ) . last )
7272 decoded = Base64 . decode64 ( payload )
7373
@@ -76,57 +76,57 @@ class RequestTest < 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
8383 settings . attributes_index = 30
8484 auth_url = OneLogin ::RubySaml ::Authrequest . new . create ( settings )
85- assert_match /^http:\/ \/ example\. com\? SAMLRequest=/ , auth_url
85+ assert_match ( /^http:\/ \/ example\. com\? SAMLRequest=/ , auth_url )
8686 payload = CGI . unescape ( auth_url . split ( "=" ) . last )
8787 decoded = Base64 . decode64 ( payload )
8888
8989 zstream = Zlib ::Inflate . new ( -Zlib ::MAX_WBITS )
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
9797 settings . force_authn = true
9898 auth_url = OneLogin ::RubySaml ::Authrequest . new . create ( settings )
99- assert_match /^http:\/ \/ example\. com\? SAMLRequest=/ , auth_url
99+ assert_match ( /^http:\/ \/ example\. com\? SAMLRequest=/ , auth_url )
100100 payload = CGI . unescape ( auth_url . split ( "=" ) . last )
101101 decoded = Base64 . decode64 ( payload )
102102
103103 zstream = Zlib ::Inflate . new ( -Zlib ::MAX_WBITS )
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
111111 settings . name_identifier_format = "urn:oasis:names:tc:SAML:2.0:nameid-format:transient"
112112 auth_url = OneLogin ::RubySaml ::Authrequest . new . create ( settings )
113- assert_match /^http:\/ \/ example\. com\? SAMLRequest=/ , auth_url
113+ assert_match ( /^http:\/ \/ example\. com\? SAMLRequest=/ , auth_url )
114114 payload = CGI . unescape ( auth_url . split ( "=" ) . last )
115115 decoded = Base64 . decode64 ( payload )
116116 zstream = Zlib ::Inflate . new ( -Zlib ::MAX_WBITS )
117117 inflated = zstream . inflate ( decoded )
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
126126 settings . name_identifier_value_requested = "[email protected] " 127127 settings . name_identifier_format = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
128128 auth_url = OneLogin ::RubySaml ::Authrequest . new . create ( settings )
129- assert_match /^http:\/ \/ example\. com\? SAMLRequest=/ , auth_url
129+ assert_match ( /^http:\/ \/ example\. com\? SAMLRequest=/ , auth_url )
130130 payload = CGI . unescape ( auth_url . split ( "=" ) . last )
131131 decoded = Base64 . decode64 ( payload )
132132 zstream = Zlib ::Inflate . new ( -Zlib ::MAX_WBITS )
@@ -141,10 +141,10 @@ class RequestTest < Minitest::Test
141141
142142 it "accept extra parameters" do
143143 auth_url = OneLogin ::RubySaml ::Authrequest . new . create ( settings , { :hello => "there" } )
144- assert_match /&hello=there$/ , auth_url
144+ assert_match ( /&hello=there$/ , auth_url )
145145
146146 auth_url = OneLogin ::RubySaml ::Authrequest . new . create ( settings , { :hello => nil } )
147- assert_match /&hello=$/ , auth_url
147+ assert_match ( /&hello=$/ , auth_url )
148148 end
149149
150150 it "RelayState cases" do
@@ -164,13 +164,13 @@ class RequestTest < Minitest::Test
164164 it "creates request with ID prefixed with default '_'" do
165165 request = OneLogin ::RubySaml ::Authrequest . new
166166
167- assert_match /^_/ , request . uuid
167+ assert_match ( /^_/ , request . uuid )
168168 end
169169
170170 it "creates request with ID is prefixed, when :id_prefix is passed" do
171171 OneLogin ::RubySaml ::Utils ::set_prefix ( "test" )
172172 request = OneLogin ::RubySaml ::Authrequest . new
173- assert_match /^test/ , request . uuid
173+ assert_match ( /^test/ , request . uuid )
174174 OneLogin ::RubySaml ::Utils ::set_prefix ( "_" )
175175 end
176176
@@ -183,15 +183,15 @@ class RequestTest < Minitest::Test
183183 err = assert_raises OneLogin ::RubySaml ::SettingError do
184184 OneLogin ::RubySaml ::Authrequest . new . create ( settings )
185185 end
186- assert_match /idp_sso_service_url is not set/ , err . message
186+ assert_match ( /idp_sso_service_url is not set/ , err . message )
187187 end
188188 end
189189
190190 describe "when the target url doesn't contain a query string" do
191191 it "create the SAMLRequest parameter correctly" do
192192
193193 auth_url = OneLogin ::RubySaml ::Authrequest . new . create ( settings )
194- assert_match /^http:\/ \/ example.com\? SAMLRequest/ , auth_url
194+ assert_match ( /^http:\/ \/ example.com\? SAMLRequest/ , auth_url )
195195 end
196196 end
197197
@@ -200,42 +200,42 @@ class RequestTest < Minitest::Test
200200 settings . idp_sso_service_url = "http://example.com?field=value"
201201
202202 auth_url = OneLogin ::RubySaml ::Authrequest . new . create ( settings )
203- assert_match /^http:\/ \/ example.com\? field=value&SAMLRequest/ , auth_url
203+ assert_match ( /^http:\/ \/ example.com\? field=value&SAMLRequest/ , auth_url )
204204 end
205205 end
206206
207207 it "create the saml:AuthnContextClassRef element correctly" do
208208 settings . authn_context = 'secure/name/password/uri'
209209 auth_doc = OneLogin ::RubySaml ::Authrequest . new . create_authentication_xml_doc ( settings )
210- assert_match /<saml:AuthnContextClassRef>secure\/ name\/ password\/ uri<\/ saml:AuthnContextClassRef>/ , auth_doc . to_s
210+ assert_match ( /<saml:AuthnContextClassRef>secure\/ name\/ password\/ uri<\/ saml:AuthnContextClassRef>/ , auth_doc . to_s )
211211 end
212212
213213 it "create multiple saml:AuthnContextClassRef elements correctly" do
214214 settings . authn_context = [ 'secure/name/password/uri' , 'secure/email/password/uri' ]
215215 auth_doc = OneLogin ::RubySaml ::Authrequest . new . create_authentication_xml_doc ( settings )
216- assert_match /<saml:AuthnContextClassRef>secure\/ name\/ password\/ uri<\/ saml:AuthnContextClassRef>/ , auth_doc . to_s
217- assert_match /<saml:AuthnContextClassRef>secure\/ email\/ password\/ uri<\/ saml:AuthnContextClassRef>/ , auth_doc . to_s
216+ assert_match ( /<saml:AuthnContextClassRef>secure\/ name\/ password\/ uri<\/ saml:AuthnContextClassRef>/ , auth_doc . to_s )
217+ assert_match ( /<saml:AuthnContextClassRef>secure\/ email\/ password\/ uri<\/ saml:AuthnContextClassRef>/ , auth_doc . to_s )
218218 end
219219
220220 it "create the saml:AuthnContextClassRef with comparison exact" do
221221 settings . authn_context = 'secure/name/password/uri'
222222 auth_doc = OneLogin ::RubySaml ::Authrequest . new . create_authentication_xml_doc ( settings )
223- assert_match /<samlp:RequestedAuthnContext[\S ]+Comparison='exact'/ , auth_doc . to_s
224- assert_match /<saml:AuthnContextClassRef>secure\/ name\/ password\/ uri<\/ saml:AuthnContextClassRef>/ , auth_doc . to_s
223+ assert_match ( /<samlp:RequestedAuthnContext[\S ]+Comparison='exact'/ , auth_doc . to_s )
224+ assert_match ( /<saml:AuthnContextClassRef>secure\/ name\/ password\/ uri<\/ saml:AuthnContextClassRef>/ , auth_doc . to_s )
225225 end
226226
227227 it "create the saml:AuthnContextClassRef with comparison minimun" do
228228 settings . authn_context = 'secure/name/password/uri'
229229 settings . authn_context_comparison = 'minimun'
230230 auth_doc = OneLogin ::RubySaml ::Authrequest . new . create_authentication_xml_doc ( settings )
231- assert_match /<samlp:RequestedAuthnContext[\S ]+Comparison='minimun'/ , auth_doc . to_s
232- assert_match /<saml:AuthnContextClassRef>secure\/ name\/ password\/ uri<\/ saml:AuthnContextClassRef>/ , auth_doc . to_s
231+ assert_match ( /<samlp:RequestedAuthnContext[\S ]+Comparison='minimun'/ , auth_doc . to_s )
232+ assert_match ( /<saml:AuthnContextClassRef>secure\/ name\/ password\/ uri<\/ saml:AuthnContextClassRef>/ , auth_doc . to_s )
233233 end
234234
235235 it "create the saml:AuthnContextDeclRef element correctly" do
236236 settings . authn_context_decl_ref = 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport'
237237 auth_doc = OneLogin ::RubySaml ::Authrequest . new . create_authentication_xml_doc ( settings )
238- assert_match /<saml:AuthnContextDeclRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport<\/ saml:AuthnContextDeclRef>/ , auth_doc . to_s
238+ assert_match ( /<saml:AuthnContextDeclRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport<\/ saml:AuthnContextDeclRef>/ , auth_doc . to_s )
239239 end
240240
241241 describe "#create_params signing with HTTP-POST binding" do
0 commit comments