Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions app/controllers/users/webauthn_setup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def process_valid_webauthn
handle_remember_device
Funnel::Registration::AddMfa.call(current_user.id, 'webauthn')
flash[:success] = t('notices.webauthn_configured')
user_session[:auth_method] = 'webauthn'
redirect_to after_mfa_setup_path
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ def piv_cac_service_link
def fallback_question
return if @hide_fallback_question
if service_provider_mfa_policy.allow_user_to_switch_method?
''
else
t('two_factor_authentication.piv_cac_fallback.question')
else
''
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ def cancel_link

def fallback_question
if service_provider_mfa_policy.allow_user_to_switch_method?
''
else
t('two_factor_authentication.webauthn_fallback.question')
else
''
end
end
end
Expand Down
17 changes: 17 additions & 0 deletions spec/features/webauthn/sign_up_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'rails_helper'

feature 'webauthn sign up' do
include OidcAuthHelper
include WebAuthnHelper

let!(:user) { sign_up_and_set_password }
Expand All @@ -21,4 +22,20 @@ def expect_webauthn_setup_error
end

it_behaves_like 'webauthn setup'

describe 'AAL3 setup' do
it 'marks the session AAL3 on setup and does not require authentication' do
mock_webauthn_setup_challenge

visit_idp_from_ial1_oidc_sp_requesting_aal3(prompt: 'select_account')
select_2fa_option('webauthn', visible: :all)

expect(current_path).to eq webauthn_setup_path

fill_in_nickname_and_click_continue
mock_press_button_on_hardware_key_on_setup

expect(current_path).to eq(sign_up_completed_path)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,26 @@ def presenter_with(arguments = {}, view = ActionController::Base.new.view_contex
end
end

describe '#fallback_question' do
context 'when the user can switch to a different method' do
let(:allow_user_to_switch_method) { true }

it 'returns a question about switching methods' do
expect(presenter.fallback_question).to eq(
t('two_factor_authentication.piv_cac_fallback.question'),
)
end
end

context 'when the user cannot switch to a different method' do
let(:allow_user_to_switch_method) { false }

it 'returns an empty string' do
expect(presenter.fallback_question).to eq('')
end
end
end

describe '#piv_cac_capture_text' do
let(:expected_text) { t('forms.piv_cac_mfa.submit') }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
end

describe '#fallback_question' do
let(:aal3_required) { false }
let(:allow_user_to_switch_method) { true }

it 'supplies a fallback_question' do
expect(presenter.fallback_question).to \
Expand Down