-
-
Notifications
You must be signed in to change notification settings - Fork 569
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
Support idp cert multi with string keys #576
Support idp cert multi with string keys #576
Conversation
👍 This looks good to merge |
formatted_cert = OneLogin::RubySaml::Utils.format_cert(idp_cert) | ||
certs[:encryption].push(OpenSSL::X509::Certificate.new(formatted_cert)) | ||
certs[type].push(OpenSSL::X509::Certificate.new(formatted_cert)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be:
certs[type.to_sym].push(OpenSSL::X509::Certificate.new(formatted_cert))
So we always generate certs with the symbol index, as it used to be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type
is a symbol, it can only be one of [:signing, :encryption]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alxckn 's code is correct here.
"encryption" => [] | ||
} | ||
response_valid_signed.settings = settings | ||
res = response_valid_signed.send(:validate_signature) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to this unittest, I expect one using a call to get_idp_cert_multi as well that verifies the certs were properly loaded on the settings object at settings_test.rb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added tests verifying that calls to get_idp_cert_multi are in fact working: 01c95db
5ec843f
to
01c95db
Compare
Thanks for the review @johnnyshields, @pitbulk |
I ran into issues while attempting to integrate with an ADFS IdP.
The issue was that when settings are initialized with a hash where keys are not symbols (ex. when loaded from a json file),
Settings#get_idp_cert_multi
is not able to retrieve the certificates.It had been reported in this issue before: #409.
This PR proposes to fallback to string keys if symbol keys are not defined.