@@ -140,7 +140,7 @@ class RubySamlTest < Minitest::Test
140
140
assert_includes logoutresponse . errors , "Doesn't match the issuer, expected: <#{ logoutresponse . settings . idp_entity_id } >, but was: <http://app.muda.no>"
141
141
end
142
142
143
- it "collect errors when collect_errors=true" do
143
+ it "collect errors when collect_errors=true" do
144
144
settings . idp_entity_id = 'http://invalid.issuer.example.com/'
145
145
logoutresponse = OneLogin ::RubySaml ::Logoutresponse . new ( unsuccessful_logout_response_document , settings )
146
146
collect_errors = true
@@ -185,7 +185,7 @@ class RubySamlTest < Minitest::Test
185
185
opts = { :matches_request_id => expected_request_id }
186
186
187
187
logoutresponse = OneLogin ::RubySaml ::Logoutresponse . new ( valid_logout_response_document , settings , opts )
188
- assert_raises ( OneLogin ::RubySaml ::ValidationError ) { logoutresponse . validate }
188
+ assert_raises ( OneLogin ::RubySaml ::ValidationError ) { logoutresponse . validate }
189
189
assert_includes logoutresponse . errors , "The InResponseTo of the Logout Response: #{ logoutresponse . in_response_to } , does not match the ID of the Logout Request sent by the SP: #{ expected_request_id } "
190
190
end
191
191
@@ -394,6 +394,21 @@ class RubySamlTest < Minitest::Test
394
394
assert logoutresponse_sign_test . send ( :validate_signature )
395
395
end
396
396
397
+ it "return false when cert expired and check_idp_cert_expiration expired" do
398
+ params [ 'RelayState' ] = params [ :RelayState ]
399
+ options = { }
400
+ options [ :get_params ] = params
401
+ settings . security [ :check_idp_cert_expiration ] = true
402
+ settings . idp_cert = nil
403
+ settings . idp_cert_multi = {
404
+ :signing => [ ruby_saml_cert_text ] ,
405
+ :encryption => [ ]
406
+ }
407
+ logoutresponse_sign_test = OneLogin ::RubySaml ::Logoutresponse . new ( params [ 'SAMLResponse' ] , settings , options )
408
+ assert !logoutresponse_sign_test . send ( :validate_signature )
409
+ assert_includes logoutresponse_sign_test . errors , "IdP x509 certificate expired"
410
+ end
411
+
397
412
it "return false when none cert on idp_cert_multi is valid" do
398
413
params [ 'RelayState' ] = params [ :RelayState ]
399
414
options = { }
@@ -404,6 +419,7 @@ class RubySamlTest < Minitest::Test
404
419
}
405
420
logoutresponse_sign_test = OneLogin ::RubySaml ::Logoutresponse . new ( params [ 'SAMLResponse' ] , settings , options )
406
421
assert !logoutresponse_sign_test . send ( :validate_signature )
422
+ assert_includes logoutresponse_sign_test . errors , "Invalid Signature on Logout Response"
407
423
end
408
424
end
409
425
end
0 commit comments