-
Notifications
You must be signed in to change notification settings - Fork 19
DPC-5454 - Switching login.gov from IAL1 to IAL2 #3019
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?
Changes from all commits
a475510
5377086
b548abd
68e49a6
ffa1719
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 |
|---|---|---|
|
|
@@ -94,67 +94,10 @@ | |
| end | ||
|
|
||
| context :user_does_not_exist do | ||
| it 'does not sign in user' do | ||
| post '/auth/login_dot_gov' | ||
| follow_redirect! | ||
| expect(response.location).to eq organizations_url | ||
| expect(response).to be_redirect | ||
| follow_redirect! | ||
| expect(response).to be_redirect | ||
| end | ||
|
|
||
| it 'sets authentication token' do | ||
| post '/auth/login_dot_gov' | ||
| follow_redirect! | ||
| expect(request.session[:login_dot_gov_token]).to eq token | ||
| expect(request.session[:login_dot_gov_token_exp]).to_not be_nil | ||
| expect(request.session[:login_dot_gov_token_exp]).to be_within(1.second).of 899.seconds.from_now | ||
| end | ||
| end | ||
| end | ||
|
|
||
| context 'IAL/1' do | ||
| before do | ||
| OmniAuth.config.test_mode = true | ||
| OmniAuth.config.add_mock(:login_dot_gov, | ||
| { uid: uuid, | ||
| info: { email: 'bob3@example.com' }, | ||
| extra: { raw_info: { all_emails: %w[bob3@example.com bobby@example.com], | ||
| ial: 'http://idmanagement.gov/ns/assurance/ial/1' } } }) | ||
| end | ||
|
|
||
| it_behaves_like 'an openid client' | ||
|
|
||
| context :user_exists do | ||
| before do | ||
| user = create(:user, email: 'bob3@example.com', given_name: 'Bob', | ||
| family_name: 'Hoskins') | ||
| create(:csp_user, user:, uuid:, csp:) | ||
| end | ||
| it 'does not update user names' do | ||
| expect(User.where(email: 'bob3@example.com', given_name: 'Bob', | ||
| family_name: 'Hoskins').count).to eq 1 | ||
| post '/auth/login_dot_gov' | ||
| follow_redirect! | ||
| expect(response.location).to eq organizations_url | ||
| expect(User.where(email: 'bob3@example.com', given_name: 'Bob', | ||
| family_name: 'Hoskins').count).to eq 1 | ||
| end | ||
|
|
||
| it 'does not set authentication token' do | ||
| post '/auth/login_dot_gov' | ||
| follow_redirect! | ||
| expect(request.session[:login_dot_gov_token]).to be_nil | ||
| expect(request.session[:login_dot_gov_token_exp]).to be_nil | ||
| end | ||
| end | ||
|
|
||
| context 'user does not exist' do | ||
| it 'does not sign in user' do | ||
| post '/auth/login_dot_gov' | ||
| follow_redirect! | ||
| expect(response.location).to eq no_account_url | ||
| expect(response).to be_redirect | ||
| end | ||
|
|
||
| it 'should log' do | ||
|
|
@@ -168,11 +111,12 @@ | |
| follow_redirect! | ||
| end | ||
|
|
||
| it 'does not set authentication token' do | ||
| it 'sets authentication token' 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. Unrelated to these changes, but when someone logs in through Login.gov and they don't have a user account, do we need to bother saving their token?
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. Thats a good question! At first I thought it might be needed for logout but looking at the documentation, it looks like its not needed. This might be worth discussing with the team. https://developers.login.gov/oidc/logout/ |
||
| post '/auth/login_dot_gov' | ||
| follow_redirect! | ||
| expect(request.session[:login_dot_gov_token]).to be_nil | ||
| expect(request.session[:login_dot_gov_token_exp]).to be_nil | ||
| expect(request.session[:login_dot_gov_token]).to eq token | ||
| expect(request.session[:login_dot_gov_token_exp]).to_not be_nil | ||
| expect(request.session[:login_dot_gov_token_exp]).to be_within(1.second).of 899.seconds.from_now | ||
| end | ||
| end | ||
| end | ||
|
|
@@ -316,7 +260,7 @@ | |
| { uid: uuid, | ||
| info: { email: 'bob4@example.com' }, | ||
| extra: { raw_info: { all_emails: %w[bob4@example.com bobby@example.com], | ||
| ial: 'http://idmanagement.gov/ns/assurance/ial/1' } } }) | ||
| ial: 'http://idmanagement.gov/ns/assurance/ial/2' } } }) | ||
| end | ||
|
|
||
| it 'should log error' do | ||
|
|
||
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.
I don't think this line should be changed, it's ensuring that the IAL level is not 1
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.
Updated it based on our conversation.