Skip to content

Commit

Permalink
Merge pull request #402 from graaff/idp_cert_multi-response-check
Browse files Browse the repository at this point in the history
Allow responses to work with only an idp_cert_multi setting
  • Loading branch information
pitbulk authored Jul 4, 2017
2 parents 5247202 + ed8bd53 commit 6ca9a93
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/onelogin/ruby-saml/logoutresponse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def valid_state?

return append_error("No issuer in settings of the logout response") if settings.issuer.nil?

if settings.idp_cert_fingerprint.nil? && settings.idp_cert.nil?
if settings.idp_cert_fingerprint.nil? && settings.idp_cert.nil? && settings.idp_cert_multi.nil?
return append_error("No fingerprint or certificate on settings of the logout response")
end

Expand Down
2 changes: 1 addition & 1 deletion lib/onelogin/ruby-saml/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def validate_response_state

return append_error("No settings on response") if settings.nil?

if settings.idp_cert_fingerprint.nil? && settings.idp_cert.nil?
if settings.idp_cert_fingerprint.nil? && settings.idp_cert.nil? && settings.idp_cert_multi.nil?
return append_error("No fingerprint or certificate on settings")
end

Expand Down
1 change: 1 addition & 0 deletions test/logoutresponse_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class RubySamlTest < Minitest::Test
it "invalidate logout response when initiated with no idp cert or fingerprint" do
settings.idp_cert_fingerprint = nil
settings.idp_cert = nil
settings.idp_cert_multi = nil
logoutresponse = OneLogin::RubySaml::Logoutresponse.new(valid_logout_response_document, settings)
assert !logoutresponse.validate
assert_includes logoutresponse.errors, "No fingerprint or certificate on settings of the logout response"
Expand Down
1 change: 1 addition & 0 deletions test/response_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class RubySamlTest < Minitest::Test
it "raise when No fingerprint or certificate on settings" do
settings.idp_cert_fingerprint = nil
settings.idp_cert = nil
settings.idp_cert_multi = nil
response.settings = settings
error_msg = "No fingerprint or certificate on settings"
assert_raises(OneLogin::RubySaml::ValidationError, error_msg) do
Expand Down

0 comments on commit 6ca9a93

Please sign in to comment.