-
Notifications
You must be signed in to change notification settings - Fork 166
Add all_emails support for SAML
#5587
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1e265da
Add `all_emails` support for SAML
jmhooper 89e4625
copy/paste whoops
jmhooper 708cbe9
whitespace
jmhooper 060ba2c
Merge branch 'main' into jmhooper-saml-multiple-emails
jmhooper 5aa74c1
Add tests for the attribute asserter
jmhooper cda1733
Merge branch 'main' into jmhooper-saml-multiple-emails
jmhooper d67121b
pending specs
jmhooper 8a58302
implement test
jmhooper File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -517,6 +517,23 @@ | |
| end | ||
| end | ||
|
|
||
| context 'custom bundle includes all_emails' do | ||
| before do | ||
| create(:email_address, user: user) | ||
| allow(service_provider.metadata).to receive(:[]).with(:attribute_bundle).and_return( | ||
| %w[all_emails], | ||
| ) | ||
| subject.build | ||
| end | ||
|
|
||
| it 'includes all the user email addresses' do | ||
| all_emails_getter = ial1_user.asserted_attributes[:all_emails][:getter] | ||
| emails = all_emails_getter.call(user) | ||
| expect(emails.length).to eq(2) | ||
| expect(emails).to match_array(user.confirmed_email_addresses.map(&:email)) | ||
|
Comment on lines
+529
to
+533
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❤️ |
||
| end | ||
| end | ||
|
|
||
| context 'custom bundle includes email, phone' do | ||
| before do | ||
| allow(service_provider.metadata).to receive(:[]).with(:attribute_bundle).and_return( | ||
|
|
||
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.
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.
codeclimate is saying this is not covered by tests 😬 can we add some?
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.
Also does retuning an array here just correctly turn into an array of some kind of tag?
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.
Yep, work in progress because I need to add some tests to this one. Gonna try to mirror the pattern I used for the OIDC implementation as much as I can.
And yep, this renders a list of values:
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.
@zachmargolis: I just pushed a test for the attribute asserter!
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.
Thanks! Test is good but can we get one that checks the full XML payload somewhere?
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.
Let me take a swing at that. I know that hidden in the SAML specs somewhere there's gotta be a test that takes apart the SAML response.
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.
@zachmargolis: Just added a test along with a bonus test for OIDC