Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More specific error messages for request certificate validation #545

2 changes: 1 addition & 1 deletion lib/onelogin/ruby-saml/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ def validate_signature
valid = false
expired = false
idp_certs[:signing].each do |idp_cert|
valid = doc.validate_document_with_cert(idp_cert)
valid = doc.validate_document_with_cert(idp_cert, @soft)
if valid
if settings.security[:check_idp_cert_expiration]
if OneLogin::RubySaml::Utils.is_cert_expired(idp_cert)
Expand Down
4 changes: 2 additions & 2 deletions lib/xml_security.rb
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def validate_document(idp_cert_fingerprint, soft = true, options = {})
validate_signature(base64_cert, soft)
end

def validate_document_with_cert(idp_cert)
def validate_document_with_cert(idp_cert, soft = true)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the softvariable (from line 258) was missing on the scope of this method

# get cert from response
cert_element = REXML::XPath.first(
self,
Expand All @@ -260,7 +260,7 @@ def validate_document_with_cert(idp_cert)

# check saml response cert matches provided idp cert
if idp_cert.to_pem != cert.to_pem
return false
return append_error("SAML response certificate does not match idp certificate", soft)
end
else
base64_cert = Base64.encode64(idp_cert.to_pem)
Expand Down