Skip to content

Commit

Permalink
Don't send request to one login when signing out after impersonation
Browse files Browse the repository at this point in the history
  • Loading branch information
CatalinVoineag committed Jan 2, 2025
1 parent c3d741c commit bf00204
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/one_login_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def sign_out
reset_session

session[:one_login_error] = one_login_error
if OneLogin.bypass?
if OneLogin.bypass? || id_token.nil?
redirect_to candidate_interface_create_account_or_sign_in_path
else
# Go back to one login to sign out the user on their end as well
Expand Down
11 changes: 9 additions & 2 deletions spec/requests/one_login_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
end
end

describe 'GET /auth/one-login/sign_out' do
describe 'GET /auth/one-login/sign-out' do
it 'redirects to one_login logout url' do
create(:candidate, email_address: '[email protected]')

Expand Down Expand Up @@ -162,9 +162,16 @@
expect(response).to redirect_to candidate_interface_create_account_or_sign_in_path
end
end

context 'session id_token is nil' do
it 'redirects to sign_in page' do
get auth_one_login_sign_out_path
expect(response).to redirect_to candidate_interface_create_account_or_sign_in_path
end
end
end

describe 'GET /auth/one-login/sign_out_complete' do
describe 'GET /auth/one-login/sign-out-complete' do
context 'when candidate has a different one login token than the one returned by one login' do
it 'redirects to logout_one_login_path and persists the session error message' do
candidate = create(:candidate, email_address: '[email protected]')
Expand Down

0 comments on commit bf00204

Please sign in to comment.