-
Notifications
You must be signed in to change notification settings - Fork 18
Patch gem for id.me. Fix unit, system and integration tests to align with new data model changes. #3018
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
base: main
Are you sure you want to change the base?
Patch gem for id.me. Fix unit, system and integration tests to align with new data model changes. #3018
Changes from all commits
49c7e79
b38beaa
653e4fb
a48e722
cc1342f
f32edc0
892b051
0099dc4
359f685
e452d81
08c230c
9629895
5f640e4
fb592c0
7807302
1216ecf
2a50289
a02ccc5
386e178
ec7bf0e
8652201
8c705e4
a5c3806
478f77e
6778849
08fb743
cb182dc
faf2875
3cdd9d0
8a435c8
9158dbd
6ec0ee1
9c5119c
db43ba6
729c0ce
187f0c3
be910bd
3b3f35d
be58ca3
72b19b3
764b99a
e75d6fb
72c6c9b
3a675d3
4f7021d
ec9a82f
8947504
64054d6
57cf436
d3dcbcb
1fb7d12
741a3e8
9420bd7
5d0877c
819dc41
9010481
4397aa2
fa1bb09
1cb0d21
baef2c5
4803ec7
4d5e8e0
f858656
1bfeaf3
47b7fe5
a90696d
c1a30f0
bc799a2
20e90ff
a44ba73
aa768e4
d93a6c2
dae0674
3c54bee
05b8bc1
ca211a9
3d9e8a4
5f07014
71348ef
d215f5c
29292c8
3204fb9
365d38e
d858f34
c9e15b8
c558375
a9bf727
601d421
3ab93eb
eea3d43
91ac26c
fb6c2aa
1760a83
8b34656
6410c06
7752228
06c3636
01de2b6
2dafb7f
f362a10
877edd8
a5552c3
3045282
b8554fd
07c98da
33a7771
0ea2110
febfeab
b2dce43
d921801
943ef14
d298538
952b078
b89bf4c
4603f37
d70da42
867684a
6b0d266
7a3789f
c0cd15a
98950be
992a0b4
4181f48
415b1c3
3b296ec
b3b6cad
cf4e3ab
68b9b51
1cbfd8c
dac08cb
4597b18
b23b8c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Application settings | ||
| DATABASE_URL=postgresql://localhost:5432/dpc-portal_development | ||
| TEST_DATABASE_URL=postgresql://localhost:5432/dpc-portal_test | ||
| GOLDEN_MACAROON=${GOLDEN_MACAROON} | ||
| API_METADATA_URL=http://localhost:3002/api/v1 | ||
| API_ADMIN_URL=http://localhost:9900 | ||
| DB_USER=postgres | ||
| DB_PASS=dpc-safe | ||
| DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL=true | ||
| CPI_API_GW_BASE_URL=http://localhost:4567/ | ||
| CMS_IDM_OAUTH_URL=http://localhost:4567/ | ||
| IDP_ID_ME_HOST=api.idmelabs.com | ||
| IDP_LOGIN_DOT_GOV_HOST=idp.int.identitysandbox.gov | ||
| RUBY_YJIT_ENABLE=1 | ||
| ENV=local | ||
| RAILS_ENV=development | ||
| NEW_RELIC_MONITOR_MODE=false | ||
| DISABLE_JSON_LOGGER=true | ||
| RAILS_DEVELOPMENT_HOSTS=host.docker.internal | ||
| SKIP_SIMPLE_COV=${SKIP_SIMPLE_COV:-} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| --require spec_helper | ||
| --order rand | ||
| -I . | ||
| -I spec |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,13 +78,13 @@ def login | |
| { actionContext: LoggingConstants::ActionContext::Registration, | ||
| actionType: LoggingConstants::ActionType::BeginLogin, | ||
| invitation: @invitation.id }]) | ||
| url = URI::HTTPS.build(host: IDP_HOST, | ||
| path: '/openid_connect/authorize', | ||
| query: { acr_values: 'http://idmanagement.gov/ns/assurance/ial/2', | ||
| client_id: IDP_CLIENT_ID, | ||
| redirect_uri: "#{my_protocol_host}/auth/login_dot_gov/callback", | ||
| csp_config = CspConfig.for(:id_me) | ||
| url = URI::HTTPS.build(host: csp_config.host, | ||
| path: '/oauth/authorize', | ||
| query: { client_id: csp_config.identifier, | ||
| redirect_uri: "#{my_protocol_host}/auth/id_me/callback", | ||
| response_type: 'code', | ||
| scope: 'openid email all_emails profile social_security_number', | ||
| scope: 'openid http://idmanagement.gov/ns/assurance/ial/2/aal/2', | ||
| nonce: @nonce, | ||
| state: @state }.to_query) | ||
| redirect_to url, allow_other_host: true | ||
|
|
@@ -100,8 +100,9 @@ def renew | |
| end | ||
|
|
||
| def set_idp_token | ||
| session[:login_dot_gov_token] = 'token' | ||
| session[:login_dot_gov_token_exp] = 2.days.from_now | ||
| session[:csp] = 'id_me' | ||
| session[:id_me_token] = 'token' | ||
| session[:id_me_token_exp] = 2.days.from_now | ||
| head :ok | ||
| end | ||
|
|
||
|
|
@@ -211,7 +212,12 @@ def user | |
| user_info = UserInfoService.new.user_info(session) | ||
| find_or_create_user(user_info) | ||
| csp = Csp.find_by(name: @user.provider) | ||
| CspUser.find_or_create_by!(user: @user, csp: csp, uuid: user_info['sub']) | ||
| csp_user = CspUser.find_or_create_by!(user: @user, csp: csp, uuid: user_info['sub']) | ||
|
|
||
| # Update emails based upon the latest information in user info. | ||
| new_emails = user_info['all_emails'] || user_info['emails'] || user_info['emails_confirmed'] | ||
|
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. can this be a separate method? like
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. Yes, but i'd like to take a step further and normalize responses into one structure e.g DPCUserInfo, so as to centralize translation and consumer access. This would be an extension of the work we discussed in today's call for creating DPCSession/CSPSession. |
||
| csp_user.add_or_activate_new_email(new_emails) | ||
| csp_user.deactivate_old_email(new_emails) | ||
| update_user(user_info) | ||
| @user | ||
| end | ||
|
|
@@ -248,7 +254,7 @@ def assign_user_attributes(user_to_create, user_info) | |
| user_to_create.pac_id = session.delete(:user_pac_id) | ||
|
|
||
| # For now we force login.gov, this will have to change once we support multi-CSP. | ||
| user_to_create.provider = :login_dot_gov | ||
| user_to_create.provider = session[:csp] || 'login_dot_gov' | ||
| user_to_create.uid = user_info['sub'] | ||
| end | ||
|
|
||
|
|
@@ -308,9 +314,11 @@ def verify_cd_invitation | |
| end | ||
|
|
||
| def check_for_token | ||
| if session[:login_dot_gov_token].present? && | ||
| session[:login_dot_gov_token_exp].present? && | ||
| session[:login_dot_gov_token_exp] > Time.now | ||
| csp = session[:csp] | ||
| if csp && !csp.empty? && | ||
| session["#{csp}_token"].present? && | ||
| session["#{csp}_token_exp"].present? && | ||
| session["#{csp}_token_exp"] > Time.now | ||
| return | ||
| end | ||
|
|
||
|
|
||
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.
should this method take the csp as a param?