28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'app/controllers/concerns/koi/controller/has_webauthn.rb', line 28
def webauthn_authenticate!
return if session_params[:response].blank?
webauthn_credential, stored_credential = webauthn_relying_party.verify_authentication(
JSON.parse(session_params[:response]),
session[:authentication_challenge],
) do |credential|
Admin::Credential.find_by!(external_id: credential.id)
end
stored_credential.update(
sign_count: webauthn_credential.sign_count,
updated_at: DateTime.current,
)
stored_credential.admin
rescue ActiveRecord::RecordNotFound
false
end
|