-
Notifications
You must be signed in to change notification settings - Fork 166
Add alternate_emails prop to OIDC userinfo
#5442
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
16 commits
Select commit
Hold shift + click to select a range
dbee02d
Add `alternate_email` prop to OIDC userinfo
jmhooper 9baefaf
Make alternate emails a separate scope
jmhooper b699914
Merge branch 'main' into jmhooper-alternate-emails
jmhooper fccb3e0
update UI
jmhooper 5c73851
Merge branch 'main' into jmhooper-alternate-emails
jmhooper daabacc
remove alternate_emails_verified prop
jmhooper d02312f
memoize email context in userinfo presenter
jmhooper e4a5f60
rename all emails to alternate emails and change behavior
jmhooper c00d0bd
cleanup tests
jmhooper 9fb18f5
cleanup UI
jmhooper 47bd4f0
whoops
jmhooper 963eabe
Merge branch 'main' into jmhooper-alternate-emails
jmhooper 288c12e
test cleanup
jmhooper fa9fe98
add sign up completions show tests
jmhooper a1cd452
add view specs
jmhooper f4df91f
missing translations
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ | |
| } | ||
|
|
||
| .success-bullets { | ||
| li { | ||
| .success-bullet { | ||
| padding: 1rem 1rem 1rem 0; | ||
|
|
||
| &::before { | ||
|
|
||
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 |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ def initialize(ial2_requested:, decorated_session:, current_user:, handoff:, ial | |
| [[:address], :address], | ||
| [[:phone], :phone], | ||
| [[:email], :email], | ||
| [[:all_emails], :all_emails], | ||
| [[:birthdate], :birthdate], | ||
| [[:social_security_number], :social_security_number], | ||
| [[:x509_subject], :x509_subject], | ||
|
|
@@ -27,6 +28,7 @@ def initialize(ial2_requested:, decorated_session:, current_user:, handoff:, ial | |
|
|
||
| SORTED_IAL1_ATTRIBUTE_MAPPING = [ | ||
| [[:email], :email], | ||
| [[:all_emails], :all_emails], | ||
| [[:x509_subject], :x509_subject], | ||
| [[:x509_issuer], :x509_issuer], | ||
| [[:verified_at], :verified_at], | ||
|
|
@@ -69,9 +71,13 @@ def image_name | |
| end | ||
|
|
||
| def requested_attributes_sorted | ||
| sorted_attribute_mapping.map do |raw_attribute, display_attribute| | ||
| sorted_attributes = sorted_attribute_mapping.map do |raw_attribute, display_attribute| | ||
| display_attribute if (requested_attributes & raw_attribute).present? | ||
| end.compact | ||
| # If the SP requests all emails, there is no reason to show them the sign | ||
|
Contributor
Author
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. Need to add a test for this behavior |
||
| # in email address in the consent screen | ||
| sorted_attributes.delete(:email) if sorted_attributes.include?(:all_emails) | ||
| sorted_attributes | ||
| end | ||
|
|
||
| def sorted_attribute_mapping | ||
|
|
||
12 changes: 10 additions & 2 deletions
12
app/views/sign_up/completions/_requested_attributes.html.erb
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
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
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 |
|---|---|---|
|
|
@@ -60,12 +60,13 @@ | |
| end | ||
|
|
||
| let(:view_context) { ActionController::Base.new.view_context } | ||
| let(:requested_attributes) { [:email] } | ||
| let(:decorated_session) do | ||
| ServiceProviderSessionDecorator.new( | ||
| sp: service_provider, | ||
| view_context: view_context, | ||
| sp_session: { | ||
| requested_attributes: [:email], | ||
| requested_attributes: requested_attributes, | ||
| }, | ||
| service_provider_request: ServiceProviderRequestProxy.new, | ||
| ) | ||
|
|
@@ -82,7 +83,7 @@ | |
| consent_has_expired: false, | ||
| ) | ||
| allow(view).to receive(:decorated_session).and_return(decorated_session) | ||
| assign(:pii, {}) | ||
| assign(:pii, { email: 'foo@example.com', all_emails: ['foo@example.com', 'bar@example.com'] }) | ||
| end | ||
|
|
||
| it 'shows the app name, not the agency name' do | ||
|
|
@@ -98,6 +99,18 @@ | |
| ), | ||
| ) | ||
| end | ||
|
|
||
| context 'the all_emails scope is requested' do | ||
|
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. should/can we add a negative spec (ex bar@example is not shown when only single email scope is requested?) |
||
| let(:requested_attributes) { [:email, :all_emails] } | ||
|
|
||
| it 'renders all of the user email addresses' do | ||
| render | ||
|
|
||
| expect(rendered).to include(t('help_text.requested_attributes.all_emails')) | ||
| expect(rendered).to include('foo@example.com') | ||
| expect(rendered).to include('bar@example.com') | ||
| end | ||
| end | ||
| end | ||
|
|
||
| private | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
We're also using this
success-bulletsclass here, which hasn't been updated yet in this branch to apply the new class to itslichildren:identity-idp/app/views/sign_up/completions/_requested_attributes.html.erb
Line 12 in 47bd4f0
Note to self: We should consider moving to design system Icon List component.
Edit: Ticket at LG-5226.
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.
Yeah, the reason for renaming the class was to prevent it from apply the success bullets list styles to this list item.
There may be a better way to accomplish that, but I don't know what it is.