File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -586,12 +586,14 @@ def validate_audience
586
586
true
587
587
end
588
588
589
- # Validates the Destination, (If the SAML Response is received where expected)
589
+ # Validates the Destination, (If the SAML Response is received where expected).
590
+ # If the response was initialized with the :skip_destination option, this validation is skipped,
590
591
# If fails, the error is added to the errors array
591
592
# @return [Boolean] True if there is a Destination element that matches the Consumer Service URL, otherwise False
592
593
#
593
594
def validate_destination
594
595
return true if destination . nil?
596
+ return true if options [ :skip_destination ]
595
597
596
598
if destination . empty?
597
599
error_msg = "The response has an empty Destination value"
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ class RubySamlTest < Minitest::Test
24
24
let ( :response_no_conditions ) { OneLogin ::RubySaml ::Response . new ( read_invalid_response ( "no_conditions.xml.base64" ) ) }
25
25
let ( :response_no_authnstatement ) { OneLogin ::RubySaml ::Response . new ( read_invalid_response ( "no_authnstatement.xml.base64" ) ) }
26
26
let ( :response_empty_destination ) { OneLogin ::RubySaml ::Response . new ( read_invalid_response ( "empty_destination.xml.base64" ) ) }
27
+ let ( :response_empty_destination_with_skip ) { OneLogin ::RubySaml ::Response . new ( read_invalid_response ( "empty_destination.xml.base64" ) , { skip_destination : true } ) }
27
28
let ( :response_no_status ) { OneLogin ::RubySaml ::Response . new ( read_invalid_response ( "no_status.xml.base64" ) ) }
28
29
let ( :response_no_statuscode ) { OneLogin ::RubySaml ::Response . new ( read_invalid_response ( "no_status_code.xml.base64" ) ) }
29
30
let ( :response_statuscode_responder ) { OneLogin ::RubySaml ::Response . new ( read_invalid_response ( "status_code_responder.xml.base64" ) ) }
@@ -436,6 +437,12 @@ class RubySamlTest < Minitest::Test
436
437
assert_includes response_empty_destination . errors , "The response has an empty Destination value"
437
438
end
438
439
440
+ it "return true when the destination of the SAML Response is empty but skip_destination option is used" do
441
+ response_empty_destination_with_skip . settings = settings
442
+ assert response_empty_destination_with_skip . send ( :validate_destination )
443
+ assert_empty response_empty_destination . errors
444
+ end
445
+
439
446
it "returns true on a case insensitive match on the domain" do
440
447
response_valid_signed_without_x509certificate . settings = settings
441
448
response_valid_signed_without_x509certificate . settings . assertion_consumer_service_url = 'http://APP.muDa.no/sso/consume'
You can’t perform that action at this time.
0 commit comments