Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
212 commits
Select commit Hold shift + click to select a range
49c7e79
sort of working
jdettmannnava Dec 26, 2025
b38beaa
working except in tests
jdettmannnava Dec 26, 2025
653e4fb
Merge branch 'main' into jd/undevise
jdettmannnava Dec 29, 2025
a48e722
working without devise
jdettmannnava Dec 29, 2025
cc1342f
better for eval
jdettmannnava Dec 29, 2025
f32edc0
cleanup
jdettmannnava Dec 29, 2025
892b051
cleanup
jdettmannnava Dec 29, 2025
0099dc4
test invitation flow
jdettmannnava Dec 30, 2025
359f685
Merge branch 'main' into jd/undevise
jdettmannnava Dec 30, 2025
e452d81
Merge branch 'main' into jd/undevise
jdettmannnava Dec 31, 2025
08c230c
Merge branch 'main' into jd/undevise
jdettmannnava Dec 31, 2025
9629895
Merge branch 'main' into jd/undevise
jdettmannnava Jan 12, 2026
5f640e4
Merge branch 'main' into jd/undevise
jdettmannnava Jan 13, 2026
fb592c0
Merge branch 'main' into jd/undevise
jdettmannnava Jan 14, 2026
7807302
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Jan 21, 2026
1216ecf
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Jan 21, 2026
2a50289
Merge branch 'jd/dpc-5127-multiple-oidc' of github.com:CMSgov/dpc-app…
jdettmannnava Jan 21, 2026
a02ccc5
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Jan 22, 2026
386e178
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Jan 23, 2026
ec7bf0e
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Jan 23, 2026
8652201
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Jan 26, 2026
8c705e4
fix user create, accessibility tests
jdettmannnava Jan 26, 2026
a5c3806
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Jan 27, 2026
478f77e
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Jan 27, 2026
6778849
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Jan 29, 2026
08fb743
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 2, 2026
cb182dc
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 3, 2026
faf2875
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 4, 2026
3cdd9d0
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 5, 2026
8a435c8
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 9, 2026
9158dbd
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 10, 2026
6ec0ee1
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 12, 2026
9c5119c
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 12, 2026
db43ba6
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 12, 2026
729c0ce
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 13, 2026
187f0c3
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 17, 2026
be910bd
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 18, 2026
3b3f35d
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 19, 2026
be58ca3
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 19, 2026
72b19b3
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 20, 2026
764b99a
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 23, 2026
e75d6fb
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 24, 2026
72c6c9b
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 26, 2026
3a675d3
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 27, 2026
4f7021d
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 27, 2026
ec9a82f
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Feb 27, 2026
8947504
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Mar 2, 2026
64054d6
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Mar 5, 2026
57cf436
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Mar 5, 2026
d3dcbcb
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Mar 10, 2026
1fb7d12
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Mar 11, 2026
741a3e8
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Mar 12, 2026
9420bd7
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Mar 13, 2026
5d0877c
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Mar 16, 2026
819dc41
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Mar 23, 2026
9010481
force merge dpc-admin and dpc-web
jdettmannnava Mar 24, 2026
4397aa2
merge main
jdettmannnava Mar 30, 2026
fa1bb09
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Mar 30, 2026
1cb0d21
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Mar 30, 2026
baef2c5
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Mar 30, 2026
4803ec7
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Apr 3, 2026
4d5e8e0
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Apr 3, 2026
f858656
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Apr 6, 2026
1bfeaf3
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Apr 6, 2026
47b7fe5
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Apr 7, 2026
a90696d
undevise javascript test
jdettmannnava Apr 7, 2026
c1a30f0
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Apr 7, 2026
bc799a2
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Apr 8, 2026
20e90ff
add login support to integration tests
jdettmannnava Apr 8, 2026
a44ba73
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Apr 9, 2026
aa768e4
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Apr 15, 2026
d93a6c2
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Apr 16, 2026
dae0674
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Apr 20, 2026
3c54bee
Merge branch 'main' into jd/dpc-5127-multiple-oidc
jdettmannnava Apr 22, 2026
05b8bc1
POC: Replace Login.gov with ID.me
ashley-weaver Apr 22, 2026
ca211a9
Update devise.rb
ashley-weaver Apr 24, 2026
3d9e8a4
Single quotes
ashley-weaver Apr 24, 2026
5f07014
Merge branch 'main' into aw/use-idme
ashley-weaver Apr 27, 2026
71348ef
Merge remote-tracking branch 'origin/aw/dpc-5368' into aw/use-idme
ashley-weaver Apr 27, 2026
d215f5c
Use port 3100
ashley-weaver Apr 27, 2026
29292c8
Send env var for client id
ashley-weaver Apr 27, 2026
3204fb9
Use ID.me
ashley-weaver Apr 27, 2026
365d38e
Update omniauth.rb
ashley-weaver Apr 27, 2026
d858f34
Update omniauth.rb
ashley-weaver Apr 28, 2026
c9e15b8
Update invitations_controller.rb
ashley-weaver Apr 28, 2026
c558375
Merge branch 'main' into aw/use-idme
ashley-weaver Apr 29, 2026
a9bf727
Update Gemfile.lock
ashley-weaver Apr 29, 2026
601d421
Update yarn.lock
ashley-weaver Apr 29, 2026
3ab93eb
Update Gemfile.lock
ashley-weaver Apr 29, 2026
eea3d43
Update tests
ashley-weaver Apr 29, 2026
91ac26c
Update application_controller.rb
ashley-weaver Apr 30, 2026
fb6c2aa
Update routes.rb
ashley-weaver Apr 30, 2026
1760a83
Update routes.rb
ashley-weaver Apr 30, 2026
8b34656
Update Gemfile.lock
ashley-weaver Apr 30, 2026
6410c06
Update Gemfile.lock
ashley-weaver Apr 30, 2026
7752228
Update omniauth.rb
ashley-weaver May 4, 2026
06c3636
Update accessibility_spec.rb
ashley-weaver May 4, 2026
01de2b6
Update user_info_service.rb
ashley-weaver May 4, 2026
2dafb7f
Merge branch 'main' into aw/use-idme
ashley-weaver May 5, 2026
f362a10
Use userinfo
ashley-weaver May 6, 2026
877edd8
Merge branch 'main' into aw/use-idme
ashley-weaver May 7, 2026
a5552c3
Use attributes endpoint
ashley-weaver May 7, 2026
3045282
Use omniauth_oidc
ashley-weaver May 7, 2026
b8554fd
Merge branch 'main' into aw/use-idme
ashley-weaver May 12, 2026
07c98da
Merge branch 'aw/use-idme' of https://github.com/CMSgov/dpc-app into …
ashley-weaver May 12, 2026
33a7771
Handle JWT response in user info endpoint
manojwadhwa81 May 12, 2026
0ea2110
Patch OpenIDConnect to handle content type for JWTs
manojwadhwa81 May 12, 2026
febfeab
Resolve merge conflicts
ashley-weaver May 12, 2026
b2dce43
Use openid_connect gem
ashley-weaver May 12, 2026
d921801
Cleanup
ashley-weaver May 12, 2026
943ef14
Update login_dot_gov_controller.rb
ashley-weaver May 12, 2026
d298538
Merge branch 'main' into aw/use-idme
ashley-weaver May 14, 2026
952b078
Merge branch 'main' into aw/use-idme
ashley-weaver May 15, 2026
b89bf4c
Fix test cases for User info service.
manojwadhwa81 May 18, 2026
4603f37
Merge remote-tracking branch 'origin/mw/handle-userinfo-jwt' into aw/…
ashley-weaver May 19, 2026
d70da42
Cleanup
ashley-weaver May 19, 2026
867684a
Merge branch 'main' into aw/use-idme
ashley-weaver May 19, 2026
6b0d266
Change provider name to id_me
ashley-weaver May 19, 2026
7a3789f
Fix failing test cases for multi csp changes
manojwadhwa81 May 19, 2026
c0cd15a
Merge remote-tracking branch 'origin/mw/handle-userinfo-jwt' into aw/…
ashley-weaver May 20, 2026
98950be
Add ruby-lsp-rspec to help with ruby-lsp extension in vscode
manojwadhwa81 May 20, 2026
992a0b4
debug gem version lock
manojwadhwa81 May 20, 2026
4181f48
Merge remote-tracking branch 'origin/aw/use-idme' into mw/handle-user…
manojwadhwa81 May 20, 2026
605376f
Merge branch 'main' into aw/use-idme
ashley-weaver May 27, 2026
415b1c3
Updated test cases to account for new models.
manojwadhwa81 May 28, 2026
6c93e9a
Merge remote-tracking branch 'origin/mw/handle-userinfo-jwt' into aw/…
ashley-weaver May 28, 2026
3b296ec
Merge branch 'main' into mw/handle-userinfo-jwt
manojwadhwa81 May 28, 2026
b3b6cad
Fix integration tests by synching user creation setup to latest data …
manojwadhwa81 May 28, 2026
18a7a1c
Separate CSP controllers
ashley-weaver May 28, 2026
e4a9941
Update tests
ashley-weaver May 28, 2026
82bc3d8
Add seeds for CSPs
ashley-weaver May 28, 2026
9c23475
Cleanup
ashley-weaver May 28, 2026
4d05900
Change sign_in hash
ashley-weaver May 29, 2026
a4d3d9e
Merge remote-tracking branch 'origin/mw/handle-userinfo-jwt' into aw/…
ashley-weaver May 29, 2026
cf4e3ab
Fix integration tests
manojwadhwa81 May 29, 2026
68b9b51
Added new UnknownCSPError class to fix quality gate error
manojwadhwa81 May 29, 2026
1cbfd8c
Fix for slow docker host: wait for button visible before attempting t…
manojwadhwa81 May 30, 2026
dac08cb
Extend wait time to 10 seconds
manojwadhwa81 May 30, 2026
4597b18
Comment out code that a) verifies modal is visible b) click on acknow…
manojwadhwa81 Jun 1, 2026
b23b8c5
Merge branch 'main' into mw/handle-userinfo-jwt
manojwadhwa81 Jun 1, 2026
47d0509
Refactor
ashley-weaver Jun 1, 2026
f36d6e3
Cleanup
ashley-weaver Jun 2, 2026
f4a77e2
Cleanup
ashley-weaver Jun 2, 2026
1348e59
Merge remote-tracking branch 'origin/mw/handle-userinfo-jwt' into aw/…
ashley-weaver Jun 2, 2026
295b116
Paramertize set_idp_token and adjusts some test cases to enable conse…
manojwadhwa81 Jun 2, 2026
e2921ed
Merge branch 'main' into mw/handle-userinfo-jwt
manojwadhwa81 Jun 2, 2026
7b483c3
Update tests
ashley-weaver Jun 2, 2026
fab8383
Comment
ashley-weaver Jun 2, 2026
c68226c
Merge branch 'main' into aw/use-idme
ashley-weaver Jun 3, 2026
bc25b07
Update invitations_controller.rb
ashley-weaver Jun 3, 2026
5a2bbdc
Update controllers
ashley-weaver Jun 3, 2026
932b863
Avoid disabling rubocop
ashley-weaver Jun 3, 2026
03224b0
Comments
ashley-weaver Jun 3, 2026
4083b7d
Update text to be CSP-generic
ashley-weaver Jun 3, 2026
5a95e28
Sonarqube cleanup
ashley-weaver Jun 3, 2026
e3056be
Parametrize specs
ashley-weaver Jun 3, 2026
ede5ea7
Sonarqube
ashley-weaver Jun 3, 2026
a044398
Update entrypoint.sh
ashley-weaver Jun 3, 2026
cd79ec2
Update dpc-portal/app/models/csp_config.rb
manojwadhwa81 Jun 3, 2026
365188d
Code cleanup
manojwadhwa81 Jun 3, 2026
abf580f
Show CSP in error messages
ashley-weaver Jun 3, 2026
62876a5
Update csp_controller.rb
ashley-weaver Jun 3, 2026
bd35bb9
Update error_component.rb
ashley-weaver Jun 3, 2026
86ec549
Refactor
ashley-weaver Jun 3, 2026
4fe919b
Cleanup
ashley-weaver Jun 3, 2026
00e48af
Update button text
ashley-weaver Jun 3, 2026
ca4dc10
Merge remote-tracking branch 'origin/mw/handle-userinfo-jwt' into aw/…
ashley-weaver Jun 4, 2026
4e33eec
Update specs
ashley-weaver Jun 4, 2026
4c1847f
Update csp_controller.rb
ashley-weaver Jun 4, 2026
e4e8416
Update csp_controller.rb
ashley-weaver Jun 4, 2026
2e73a62
Update csp_controller.rb
ashley-weaver Jun 4, 2026
7adf9dd
Update error_component.rb
ashley-weaver Jun 4, 2026
cdf0e3c
Specs
ashley-weaver Jun 4, 2026
1a032bd
Update login_dot_gov_controller.rb
ashley-weaver Jun 4, 2026
c4a0ebc
Refactor
ashley-weaver Jun 4, 2026
21c6726
Cleanup
ashley-weaver Jun 4, 2026
de44930
[DPC-5500] update sign in and verify buttons to link to all CSP's (#3…
lukey-luke Jun 5, 2026
c02d9be
Merge remote-tracking branch 'origin/mw/handle-userinfo-jwt' into aw/…
ashley-weaver Jun 5, 2026
cfe977e
Invitation tests
ashley-weaver Jun 5, 2026
7d09075
Address Copilot review comments
ashley-weaver Jun 5, 2026
e11fca2
Merge branch 'main' into aw/use-idme
ashley-weaver Jun 5, 2026
f3057b3
Update csp_controller.rb
ashley-weaver Jun 5, 2026
a274f1f
Merge branch 'main' into aw/use-idme
ashley-weaver Jun 10, 2026
b2ae0a6
Merge branch 'main' into aw/use-idme
ashley-weaver Jun 11, 2026
9879dbc
ErrorComponent doesn't care about CSP
ashley-weaver Jun 11, 2026
5fa870a
Update csp_controller.rb
ashley-weaver Jun 11, 2026
829800a
Merge remote-tracking branch 'origin/multi-csp-feature-branch-1' into…
ashley-weaver Jun 11, 2026
47c55e2
Update verify_resource_health_job_spec.rb
ashley-weaver Jun 11, 2026
93a5aec
Add CSP context to error UI and logs
ashley-weaver Jun 15, 2026
810de61
Refactor invitations controller and update specs
ashley-weaver Jun 15, 2026
4ba7410
Update invitations_spec.rb
ashley-weaver Jun 15, 2026
ac435b9
Update application_controller.rb
ashley-weaver Jun 15, 2026
d0a2c05
Update invitations_spec.rb
ashley-weaver Jun 15, 2026
eb304b0
Update invitations_spec.rb
ashley-weaver Jun 15, 2026
639421d
Update csp_controller.rb
ashley-weaver Jun 15, 2026
e438660
Update invitation_login_component.html.erb
ashley-weaver Jun 15, 2026
06a8024
Cleanup
ashley-weaver Jun 15, 2026
718a426
Cleanup
ashley-weaver Jun 15, 2026
13b95f9
Cleanup
ashley-weaver Jun 15, 2026
50b503b
Refactor
ashley-weaver Jun 15, 2026
1d65f9f
Update error text
ashley-weaver Jun 16, 2026
aee037d
Update csp_controller.rb
ashley-weaver Jun 16, 2026
7524b49
Cleanup
ashley-weaver Jun 16, 2026
fbd4804
Update id_me_spec.rb
ashley-weaver Jun 17, 2026
930b923
Update tests
ashley-weaver Jun 17, 2026
d13182a
Move CSP rows to seeds file
ashley-weaver Jun 17, 2026
0503be9
Update specs
ashley-weaver Jun 17, 2026
b8d604c
Merge remote-tracking branch 'origin/multi-csp-feature-branch-1' into…
ashley-weaver Jun 17, 2026
cbd6158
Update csp_controller.rb
ashley-weaver Jun 17, 2026
153403a
Extract CSP error handling; block IAL1 logins
ashley-weaver Jun 17, 2026
6ecfec4
Update accessibility_spec.rb
ashley-weaver Jun 17, 2026
694277f
Update accessibility_spec.rb
ashley-weaver Jun 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dpc-portal-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ make portal

# Prepare the environment
docker compose -p start-v1-portals -f docker-compose.yml -f docker-compose.portals.yml up db --wait
docker compose -p start-v1-portals -f docker-compose.yml -f docker-compose.portals.yml run --entrypoint "bundle exec rails db:create db:migrate RAILS_ENV=test" dpc_portal
docker compose -p start-v1-portals -f docker-compose.yml -f docker-compose.portals.yml run --entrypoint "bundle exec rails db:create db:migrate db:seed RAILS_ENV=test" dpc_portal
docker compose -p start-v1-portals -f docker-compose.yml -f docker-compose.portals.yml run --entrypoint "bundle exec rails assets:clobber" dpc_portal

# Run the tests
Expand Down
2 changes: 1 addition & 1 deletion dpc-portal/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ gem 'lograge'
gem 'lookbook', '>= 2.3.3' # install lookbook so it can be deployed in lower environments.
gem 'luhnacy', '~> 0.2.1'
gem 'macaroons'
gem 'net-imap', '>= 0.5.14'
gem 'net-imap', '>= 0.6.4.1'
gem 'newrelic_rpm', '~> 8.10'
gem 'nokogiri', '>= 1.19.3'
gem 'omniauth_openid_connect', '~> 0.8.0'
Expand Down
6 changes: 3 additions & 3 deletions dpc-portal/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ GEM
omniauth_openid_connect (0.8.0)
omniauth (>= 1.9, < 3)
openid_connect (~> 2.2)
openid_connect (2.3.0)
openid_connect (2.3.1)
activemodel
attr_required (>= 1.0.0)
email_validator
Expand Down Expand Up @@ -400,7 +400,7 @@ GEM
raabro (1.4.0)
racc (1.8.1)
rack (3.2.6)
rack-oauth2 (2.2.1)
rack-oauth2 (2.3.0)
activesupport
attr_required
faraday (~> 2.0)
Expand Down Expand Up @@ -649,7 +649,7 @@ DEPENDENCIES
lookbook (>= 2.3.3)
luhnacy (~> 0.2.1)
macaroons
net-imap (>= 0.5.14)
net-imap (>= 0.6.4.1)
newrelic_rpm (~> 8.10)
nokogiri (>= 1.19.3)
omniauth-rails_csrf_protection
Expand Down
2 changes: 1 addition & 1 deletion dpc-portal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The following commands can be useful for manual interaction:

```sh
$ make portal-sh
> rails db:create db:migrate RAILS_ENV=test # Create the test database
> rails db:create db:migrate db:seed RAILS_ENV=test # Create the test database
> bundle exec rspec path/to/test # Run individual test files
```

Expand Down
16 changes: 8 additions & 8 deletions dpc-portal/app/components/page/utility/error_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
<% when :cd_accepted %>
<%= link_to 'Go to DPC home', root_url, class: 'usa-button margin-right-0' %>
<% when :pii_mismatch %>
<%= render Core::Button::ButtonComponent.new(label: "Sign out of Login.gov",
destination: login_dot_gov_logout_path(invitation_id: @invitation.id),
<%= render Core::Button::ButtonComponent.new(label: "Sign out of #{@csp_display_name}",
destination: csp_logout_path(invitation_id: @invitation.id),
method: :delete) %>
<% when :email_mismatch %>
<%= render Core::Button::ButtonComponent.new(label: "Sign out of Login.gov",
destination: login_dot_gov_logout_path(invitation_id: @invitation.id),
<%= render Core::Button::ButtonComponent.new(label: "Sign out of #{@csp_display_name}",
destination: csp_logout_path(invitation_id: @invitation.id),
method: :delete) %>
<% when :no_account %>
<%= render Core::Button::ButtonComponent.new(label: "Sign out of Login.gov",
destination: login_dot_gov_logout_path,
<%= render Core::Button::ButtonComponent.new(label: "Sign out of #{@csp_display_name}",
destination: csp_logout_path,
method: :delete) %>
<% when :login_gov_signin_cancel %>
<% when /signin_cancel/ %>
<%= link_to 'Back to portal home', sign_in_path, class: 'usa-button usa-button--outline', data: { turbo: false }%>
<% when :login_gov_signin_fail %>
<% when /signin_fail/ %>
<%= link_to 'Back to portal home', sign_in_path, class: 'usa-button usa-button--outline', data: { turbo: false }%>
<% end %>
</div>
20 changes: 14 additions & 6 deletions dpc-portal/app/components/page/utility/error_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,28 @@ module Page
module Utility
# Displays unfixable error message in accept invitation process
class ErrorComponent < ViewComponent::Base
def initialize(invitation, reason)
DISPLAY_NAMES = {
login_dot_gov: 'Login.gov',
id_me: 'ID.me'
}.freeze

def initialize(invitation, reason, csp: :login_dot_gov)
super()
@invitation = invitation
@org_name = invitation&.provider_organization&.name
@ao_full_name = invitation&.invited_by_full_name
@ao_email = invitation&.invited_by&.email
@reason = if AoVerificationService::SERVER_ERRORS.include?(reason)
:server_error
else
reason.to_sym
end
@csp_display_name = DISPLAY_NAMES.fetch(csp, 'CSP')
@reason = resolve_reason(reason)
@status = "verification.#{@reason}_status"
@text = "verification.#{@reason}_text"
end

private

def resolve_reason(reason)
AoVerificationService::SERVER_ERRORS.include?(reason) ? :server_error : reason.to_sym
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,15 @@ def no_account
render(Page::Utility::ErrorComponent.new(nil, reason))
end

def login_gov_signin_cancel
reason = 'login_gov_signin_cancel'
# @param csp select { choices: [:login_dot_gov, :id_me] }
def csp_signin_cancel(csp)
reason = "#{csp}_signin_cancel"
render(Page::Utility::ErrorComponent.new(nil, reason))
end

def login_gov_signin_fail
reason = 'login_gov_signin_fail'
# @param csp select { choices: [:login_dot_gov, :id_me] }
def csp_signin_fail(csp)
reason = "#{csp}_signin_fail"
render(Page::Utility::ErrorComponent.new(nil, reason))
end
end
Expand Down
113 changes: 12 additions & 101 deletions dpc-portal/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# frozen_string_literal: true

# Parent class of all controllers
class ApplicationController < ActionController::Base # rubocop:disable Metrics/ClassLength
class ApplicationController < ActionController::Base
include CspLogout
include OrganizationAccess

before_action :check_session_length
before_action :set_current_request_attributes
before_action :no_store
Expand All @@ -13,7 +16,7 @@ def active_url
end

def current_user
@current_user ||= User.where(id: session['user']).first
@current_user ||= User.find_by(id: session[:user])
end

def authenticate_user!
Expand All @@ -24,8 +27,8 @@ def authenticate_user!
redirect_to sign_in_path
end

def sign_in(user, csp: 'login_dot_gov')
session['user'] = user.id
def sign_in(user:, csp:)
session[:user] = user.id
session[:csp] = csp.to_s
end

Expand All @@ -37,54 +40,9 @@ def check_user_verification
render(Page::Utility::AccessDeniedComponent.new(failure_code: "verification.#{current_user.verification_reason}"))
end

def tos_accepted
return if @organization.terms_of_service_accepted_by.present?

if current_user.ao?(@organization)
render(Page::Organization::TosFormComponent.new(@organization))
else
flash[:notice] = 'Organization is not ready for credential management'
redirect_to organizations_path
end
end

def url_for_logout(csp)
case csp.to_s
when :id_me.to_s
url_for_id_me_logout
when :login_dot_gov.to_s
url_for_login_dot_gov_logout
else
raise UnknownCSPError, csp
end
end

# Documentation at https://developers.login.gov/oidc/logout/
def url_for_login_dot_gov_logout
state = SecureRandom.hex(16)
session['omniauth.state'] = state
csp_config = CspConfig.for(:login_dot_gov)
URI::HTTPS.build(host: csp_config.host,
path: csp_config.log_out_path,
query: { client_id: csp_config.identifier,
post_logout_redirect_uri: "#{root_url}auth/logged_out",
state: }.to_query)
end

def url_for_id_me_logout
state = SecureRandom.hex(16)
session['omniauth.state'] = state
URI::HTTPS.build(host: CspConfig.for(:id_me).host,
path: CspConfig.for(:id_me).log_out_path,
query: { client_id: CspConfig.for(:id_me).identifier,
redirect_uri: "#{root_url}auth/logged_out" }.to_query)
end

# rubocop:disable Metrics/AbcSize
def check_session_length
session[:logged_in_at] = Time.now if session[:logged_in_at].nil?
max_session = User.remember_for.to_i / 60
return unless max_session.minutes.ago > session[:logged_in_at]
session[:logged_in_at] ||= Time.now
return unless session_timed_out?

reset_session
flash[:notice] = t('devise.failure.max_session_timeout', default: 'Your session has timed out.')
Expand All @@ -93,47 +51,9 @@ def check_session_length
actionType: LoggingConstants::ActionType::SessionTimedOut }])
redirect_to sign_in_path
end
# rubocop:enable Metrics/AbcSize

def organization_id
params[:organization_id]
end

def load_organization
@organization = ProviderOrganization.find(organization_id)
CurrentAttributes.save_organization_attributes(@organization, current_user)
rescue ActiveRecord::RecordNotFound
render file: "#{Rails.root}/public/404.html", layout: false, status: :not_found
end

def require_can_access
redirect_to organizations_path unless current_user.can_access?(@organization)

verify_status
end

def require_ao
redirect_to organizations_path unless current_user.ao?(@organization)

verify_status
end

def verify_status
if @organization.rejected?
failure_code = "#{code_prefix}.#{@organization.verification_reason}"
return render(Page::Utility::AccessDeniedComponent.new(organization: @organization, failure_code:))
end

links = current_user.ao_org_links.where(provider_organization: @organization)
return if links.empty? || links.any?(&:verification_status?)

failure_code = "verification.#{links.first.verification_reason}"
render(Page::Utility::AccessDeniedComponent.new(organization: @organization, failure_code:))
end

def code_prefix
has_ao_link = current_user.ao_org_links.where(provider_organization: @organization).exists?
has_ao_link ? 'verification' : 'cd_access'
def session_timed_out?
User.remember_for.ago > session[:logged_in_at]
end

def set_current_request_attributes
Expand All @@ -154,15 +74,6 @@ def log_credential_action(credential_type, dpc_api_credential_id, action)

# Helper method for logging csp with actionContext and actionType whenever it's available on the session
def csp_log_context
return {} if session[:csp].blank?

{ csp: session[:csp] }
end
end

# Error class to handle unknow CSP
class UnknownCSPError < StandardError # rubocop:disable Style/OneClassPerFile
def initialize(provider)
super("Unknown CSP: #{provider}")
session[:csp].present? ? { csp: session[:csp] } : {}
end
end
46 changes: 46 additions & 0 deletions dpc-portal/app/controllers/concerns/csp_email_sync.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# frozen_string_literal: true

# Handles CSP emails
module CspEmailSync
def sync_csp_emails(csp_user, new_emails, primary_email)
return unless csp_user

existing_emails = csp_user.user_emails

# Scan through all of the emails from the CSP and add or update as necessary.
ActiveRecord::Base.transaction do
add_or_activate_new_email(csp_user, new_emails, existing_emails)
deactivate_old_email(new_emails, existing_emails)
update_primary_email(csp_user, primary_email)
end
end

private

def add_or_activate_new_email(csp_user, new_emails, existing_emails)
new_emails&.each do |new_email|
existing_email = existing_emails.find { |e| e.email == new_email }
existing_email ? activate_email(existing_email) : UserEmail.create!(csp_user:, email: new_email, active: true)
end
end

def deactivate_old_email(new_emails, existing_emails)
# If an existing email is no longer in the list provided by the CSP, deactivate it.
existing_emails&.each do |existing_email|
next if new_emails&.include?(existing_email.email)

existing_email.update!(active: false, deactivated_at: Time.current, reactivated_at: nil)
end
end

def activate_email(user_email)
return if user_email.active?

user_email.update!(active: true, deactivated_at: nil, reactivated_at: Time.current)
end

def update_primary_email(csp_user, primary_email)
current_email = csp_user.user_emails.find_by(email: primary_email)
current_email&.update!(primary: true) unless current_email&.primary?
end
end
32 changes: 32 additions & 0 deletions dpc-portal/app/controllers/concerns/csp_error_handling.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# frozen_string_literal: true

# Handles errors in CSP flow
module CspErrorHandling
extend ActiveSupport::Concern

def handle_invitation_flow_failure(invitation_id)
Rails.logger.info(['Failed invitation flow',
{ actionContext: LoggingConstants::ActionContext::Registration,
actionType: LoggingConstants::ActionType::FailedLogin,
**csp_log_context }])
invitation = Invitation.find(invitation_id)
if invitation.credential_delegate?
render(Page::Utility::ErrorComponent.new(invitation, 'fail_to_proof'), status: :forbidden)
else
render(Page::Invitations::AoFlowFailComponent.new(invitation, 'fail_to_proof', 1), status: :forbidden)
end
end

def handle_signin_fail(csp)
Rails.logger.error 'CSP Configuration error'
render(Page::Utility::ErrorComponent.new(nil, "#{csp || 'csp'}_signin_fail"))
end

def handle_signin_cancel(csp)
Rails.logger.info(['User cancelled login',
{ actionContext: LoggingConstants::ActionContext::Authentication,
actionType: LoggingConstants::ActionType::UserCancelledLogin,
**csp_log_context }])
render(Page::Utility::ErrorComponent.new(nil, "#{csp || 'csp'}_signin_cancel"))
end
end
Loading
Loading