Support idp cert multi with string keys#576
Merged
pitbulk merged 3 commits intoSAML-Toolkits:masterfrom Jan 2, 2023
Merged
Conversation
Collaborator
|
👍 This looks good to merge |
pitbulk
reviewed
Aug 12, 2021
| certs_for_type.each do |idp_cert| | ||
| 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)) |
Collaborator
There was a problem hiding this comment.
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.
Contributor
Author
There was a problem hiding this comment.
type is a symbol, it can only be one of [:signing, :encryption]
pitbulk
reviewed
Aug 12, 2021
| "encryption" => [] | ||
| } | ||
| response_valid_signed.settings = settings | ||
| res = response_valid_signed.send(:validate_signature) |
Collaborator
There was a problem hiding this comment.
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
Contributor
Author
There was a problem hiding this comment.
Added tests verifying that calls to get_idp_cert_multi are in fact working: 01c95db
5ec843f to
01c95db
Compare
Contributor
Author
|
Thanks for the review @johnnyshields, @pitbulk |
Collaborator
pitbulk
approved these changes
Jan 2, 2023
pitbulk
approved these changes
Jan 2, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_multiis 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.