Sha256: 4bcffb71e060600d03db1046db11568246708faef2e887708b4562ff7a443ad5

Contents?: true

Size: 1.23 KB

Versions: 29

Compression:

Stored size: 1.23 KB

Contents

# frozen-string-literal: true

module Rodauth
  Feature.define(:webauthn_verify_account, :WebauthnVerifyAccount) do
    depends :verify_account, :webauthn

    def verify_account_view
      webauthn_setup_view
    end

    def create_account_set_password?
      false
    end

    def verify_account_set_password?
      false
    end

    def autologin_session(autologin_type)
      super
      if autologin_type == 'verify_account'
        set_session_value(authenticated_by_session_key, ['webauthn'])
        remove_session_value(autologin_type_session_key)
        webauthn_update_session(@webauthn_credential.id)
      end
    end

    private

    def before_verify_account
      super
      if features.include?(:json) && use_json? && !param_or_nil(webauthn_setup_param)
        cred = new_webauthn_credential
        json_response[webauthn_setup_param] = cred.as_json
        json_response[webauthn_setup_challenge_param] = cred.challenge
        json_response[webauthn_setup_challenge_hmac_param] = compute_hmac(cred.challenge)
      end
      @webauthn_credential = webauthn_setup_credential_from_form_submission
      add_webauthn_credential(@webauthn_credential)
    end

    def webauthn_account_id
      super || account_id
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
rodauth-2.37.0 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.36.0 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.34.0 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.33.0 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.32.0 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.31.0 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.30.0 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.29.0 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.28.0 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.27.0 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.26.1 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.26.0 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.25.0 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.24.0 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.23.0 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.22.0 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.21.0 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.20.0 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.19.0 lib/rodauth/features/webauthn_verify_account.rb
rodauth-2.18.0 lib/rodauth/features/webauthn_verify_account.rb