@@ -303,9 +303,11 @@ def post_xml(xml = :example_response, opts = {})
303303 context "when relay state is an absolute https URL" do
304304 let ( :relay_state ) { "https://example.com/" }
305305
306- it "raises an invalid relay state error" do
307- expect { post_slo_response } .
308- to raise_error ( OmniAuth ::Strategies ::SAML ::ValidationError , "Invalid RelayState" )
306+ it "redirects without a location header" do
307+ post_slo_response
308+
309+ expect ( last_response ) . to be_redirect
310+ expect ( last_response . headers . fetch ( "Location" ) ) . to be_nil
309311 end
310312 end
311313
@@ -335,7 +337,12 @@ def post_xml(xml = :example_response, opts = {})
335337 context "when response relay state is invalid" do
336338 let ( :relay_state ) { "javascript:alert(1)" }
337339
338- it { expect { post_slo_response } . to raise_error ( OmniAuth ::Strategies ::SAML ::ValidationError , "Invalid RelayState" ) }
340+ it "redirects without a location header" do
341+ post_slo_response
342+
343+ expect ( last_response ) . to be_redirect
344+ expect ( last_response . headers . fetch ( "Location" ) ) . to be_nil
345+ end
339346 end
340347 end
341348 end
@@ -452,9 +459,12 @@ def post_xml(xml = :example_response, opts = {})
452459 }
453460 end
454461
455- it "raises an error" do
456- expect { subject } .
457- to raise_error ( OmniAuth ::Strategies ::SAML ::ValidationError , "Invalid RelayState" )
462+ it "redirects without including a RelayState parameter" do
463+ subject
464+
465+ expect ( last_response ) . to be_redirect
466+ expect ( last_response . location ) . to match %r{https://idp\. sso\. example\. com/signoff/29490}
467+ expect ( last_response . location ) . not_to match ( /RelayState=/ )
458468 end
459469 end
460470 end
@@ -634,7 +644,13 @@ def test_default_relay_state(static_default_relay_state = nil, &block_default_re
634644 let ( :params ) { { RelayState : "//example.com" } }
635645 subject { post "/auth/saml/spslo" , params }
636646
637- it { expect { subject } . to raise_error ( OmniAuth ::Strategies ::SAML ::ValidationError , "Invalid RelayState" ) }
647+ it "redirects without including a RelayState parameter" do
648+ subject
649+
650+ expect ( last_response ) . to be_redirect
651+ expect ( last_response . location ) . to match %r{https://idp\. sso\. example\. com/signoff/29490}
652+ expect ( last_response . location ) . not_to match ( /RelayState=/ )
653+ end
638654 end
639655
640656 it "should give not implemented without an idp_slo_service_url" do
0 commit comments