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
4 changes: 3 additions & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class User < ApplicationRecord
MAX_RECENT_EVENTS = 5
MAX_RECENT_DEVICES = 5

BIOMETRIC_COMPARISON_IDV_LEVELS = %w[unsupervised_with_selfie in_person].to_set.freeze

enum otp_delivery_preference: { sms: 0, voice: 1 }

# rubocop:disable Rails/HasManyOrHasOneDependent
Expand Down Expand Up @@ -365,7 +367,7 @@ def identity_verified?(service_provider: nil)
end

def identity_verified_with_selfie?
active_profile&.idv_level == 'unsupervised_with_selfie'
BIOMETRIC_COMPARISON_IDV_LEVELS.include?(active_profile&.idv_level)
end

def reproof_for_irs?(service_provider:)
Expand Down
10 changes: 10 additions & 0 deletions spec/controllers/openid_connect/authorization_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,16 @@
end
end

context 'biometric comparison was performed in-person' do
it 'redirects to the redirect_uri immediately when pii is unlocked if client-side redirect is disabled' do
user.active_profile.idv_level = :in_person

action

expect(response).to redirect_to(/^#{params[:redirect_uri]}/)
end
end

context 'selfie capture not enabled, biometric_comparison_check requested by sp' do
let(:selfie_capture_enabled) { false }
it 'returns status not_acceptable' do
Expand Down
14 changes: 13 additions & 1 deletion spec/controllers/saml_idp_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ def name_id_version(format_urn)
end
end

context 'the user has proofed with a biometric check' do
context 'the user has proofed with a biometric check remotely' do
before do
user.active_profile.update!(idv_level: :unsupervised_with_selfie)
end
Expand All @@ -670,6 +670,18 @@ def name_id_version(format_urn)
end
end

context 'the user has proofed with a biometric check in-person' do
before do
user.active_profile.update!(idv_level: :in_person)
end

it 'does not redirect to proofing' do
saml_get_auth(vtr_settings)
expect(response).to redirect_to(sign_up_completed_url)
expect(controller.session[:sp][:vtr]).to eq(['C1.C2.P1.Pb'])
end
end

context 'selfie check is disabled for the environment' do
let(:doc_auth_selfie_capture_enabled) { false }

Expand Down
6 changes: 6 additions & 0 deletions spec/models/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,12 @@ def it_should_not_send_survey
expect(user.identity_verified_with_selfie?).to eq false
end

it 'return true if user has an active in-person profile' do
active_profile.idv_level = :in_person
active_profile.save
expect(user.identity_verified_with_selfie?).to eq true
end

context 'user does not have active profile' do
let(:active_profile) { nil }
it 'returns false' do
Expand Down