Skip to content

Commit

Permalink
log aaguid for webauthn
Browse files Browse the repository at this point in the history
  • Loading branch information
mdiarra3 committed Aug 28, 2024
1 parent e978a7f commit f07d030
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/forms/webauthn_verification_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def extra_analytics_attributes
{
webauthn_configuration_id: webauthn_configuration&.id,
frontend_error: webauthn_error.presence,
webauthn_aaguid: webauthn_configuration&.aaguid,
}.compact
end
end
16 changes: 11 additions & 5 deletions spec/forms/webauthn_verification_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
let(:screen_lock_error) { nil }
let(:platform_authenticator) { false }
let(:client_data_json) { verification_client_data_json }
let(:webauthn_aaguid) { nil }
let!(:webauthn_configuration) do
return if !user
create(
Expand All @@ -18,6 +19,7 @@
credential_id: credential_id,
credential_public_key: credential_public_key,
platform_authenticator: platform_authenticator,
aaguid: webauthn_aaguid,
)
end

Expand Down Expand Up @@ -45,20 +47,24 @@
subject(:result) { form.submit }

context 'when the input is valid' do
it 'returns successful result' do
expect(result.to_h).to eq(
success: true,
webauthn_configuration_id: webauthn_configuration.id,
)
context 'security key' do
it 'returns successful result' do
expect(result.to_h).to eq(
success: true,
webauthn_configuration_id: webauthn_configuration.id,
)
end
end

context 'for platform authenticator' do
let(:platform_authenticator) { true }
let(:webauthn_aaguid) { aaguid }

it 'returns successful result' do
expect(result.to_h).to eq(
success: true,
webauthn_configuration_id: webauthn_configuration.id,
webauthn_aaguid: aaguid,
)
end
end
Expand Down

0 comments on commit f07d030

Please sign in to comment.