@@ -406,12 +406,18 @@ def post_xml(xml = :example_response, opts = {})
406406 context "when the validator option is nil" do
407407 let ( :saml_options ) { super ( ) . merge ( slo_relay_state_validator : nil ) }
408408
409- it { is_expected . to have_attributes ( location : a_string_matching ( /RelayState=javascript%3Aalert%281%29 / ) ) }
409+ it { is_expected . to have_attributes ( location : a_string_matching ( /RelayState=%2Fsigned-out / ) ) }
410410 end
411411
412412 context "when the validator option is false" do
413413 let ( :saml_options ) { super ( ) . merge ( slo_relay_state_validator : false ) }
414414
415+ it { is_expected . to have_attributes ( location : a_string_matching ( /RelayState=%2Fsigned-out/ ) ) }
416+ end
417+
418+ context "when the validator option is true" do
419+ let ( :saml_options ) { super ( ) . merge ( slo_relay_state_validator : true ) }
420+
415421 it { is_expected . to have_attributes ( location : a_string_matching ( /RelayState=javascript%3Aalert%281%29/ ) ) }
416422 end
417423
@@ -547,34 +553,40 @@ def test_default_relay_state(static_default_relay_state = nil, &block_default_re
547553 it { is_expected . to be_redirect . and have_attributes ( location : a_string_matching ( /RelayState=%2Fsigned-out/ ) ) }
548554 end
549555
550- context 'with a javascript relay state' do
551- let ( :params ) { { RelayState : "javascript:alert(1)" } }
556+ context 'with a javascript relay state' do
557+ let ( :params ) { { RelayState : "javascript:alert(1)" } }
552558
553- it { is_expected . to be_redirect . and have_attributes ( location : a_string_matching ( /RelayState=%2Fsigned-out/ ) ) }
559+ it { is_expected . to be_redirect . and have_attributes ( location : a_string_matching ( /RelayState=%2Fsigned-out/ ) ) }
554560
555- context 'when the validator would reject the default' do
556- let ( :saml_options ) do
557- super ( ) . merge ( slo_relay_state_validator : proc { |value | value . start_with? ( "https://" ) } )
561+ context 'when the validator would reject the default' do
562+ let ( :saml_options ) do
563+ super ( ) . merge ( slo_relay_state_validator : proc { |value | value . start_with? ( "https://" ) } )
564+ end
565+
566+ it { is_expected . to be_redirect . and have_attributes ( location : a_string_matching ( /RelayState=%2Fsigned-out/ ) ) }
558567 end
559568
560- it { is_expected . to be_redirect . and have_attributes ( location : a_string_matching ( /RelayState=%2Fsigned-out/ ) ) }
561- end
569+ context 'when the validator is nil' do
570+ let ( :saml_options ) { super ( ) . merge ( slo_relay_state_validator : nil ) }
562571
563- context 'when the validator is nil' do
564- let ( :saml_options ) { super ( ) . merge ( slo_relay_state_validator : nil ) }
572+ it { is_expected . to be_redirect . and have_attributes ( location : a_string_matching ( /RelayState=%2Fsigned-out/ ) ) }
573+ end
565574
566- it { is_expected . to be_redirect . and have_attributes ( location : a_string_matching ( /RelayState=javascript%3Aalert%281%29/ ) ) }
567- end
575+ context 'when the validator is false' do
576+ let ( :saml_options ) { super ( ) . merge ( slo_relay_state_validator : false ) }
568577
569- context 'when the validator is false' do
570- let ( :saml_options ) { super ( ) . merge ( slo_relay_state_validator : false ) }
578+ it { is_expected . to be_redirect . and have_attributes ( location : a_string_matching ( /RelayState=%2Fsigned-out/ ) ) }
579+ end
571580
572- it { is_expected . to be_redirect . and have_attributes ( location : a_string_matching ( /RelayState=javascript%3Aalert%281%29/ ) ) }
573- end
581+ context 'when the validator is true' do
582+ let ( :saml_options ) { super ( ) . merge ( slo_relay_state_validator : true ) }
574583
575- context 'when the validator returns false' do
576- let ( :saml_options ) do
577- super ( ) . merge ( slo_relay_state_validator : proc { |state | state == "/signed-out" } )
584+ it { is_expected . to be_redirect . and have_attributes ( location : a_string_matching ( /RelayState=javascript%3Aalert%281%29/ ) ) }
585+ end
586+
587+ context 'when the validator returns false' do
588+ let ( :saml_options ) do
589+ super ( ) . merge ( slo_relay_state_validator : proc { |state | state == "/signed-out" } )
578590 end
579591
580592 it { is_expected . to be_redirect . and have_attributes ( location : a_string_matching ( /RelayState=%2Fsigned-out/ ) ) }
0 commit comments