Class: Devise::SecurityKeyAuthenticationOptionsController

Inherits:
DeviseController
  • Object
show all
Defined in:
app/controllers/devise/security_key_authentication_options_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/devise/security_key_authentication_options_controller.rb', line 9

def create
  security_key_authentication_options =
    WebAuthn::Credential.options_for_get(
      allow: @resource.webauthn_credentials.pluck(:external_id),
      user_verification: "discouraged"
    )

  # Store challenge in session for later verification
  session[:two_factor_authentication_challenge] = security_key_authentication_options.challenge

  render json: security_key_authentication_options
end