Require resident keys by default
This commit is contained in:
@@ -46,7 +46,7 @@ class ActionPack::Railtie < Rails::Railtie
|
|||||||
|
|
||||||
initializer "action_pack.passkey.holder" do
|
initializer "action_pack.passkey.holder" do
|
||||||
ActiveSupport.on_load(:active_record) do
|
ActiveSupport.on_load(:active_record) do
|
||||||
# We need this shim because Holder is namespaced under Passkey, which is an ActiveRecort
|
# We need this shim because Holder is namespaced under Passkey, which is an ActiveRecord
|
||||||
# and can't be required before ActiveRecord is loaded.
|
# and can't be required before ActiveRecord is loaded.
|
||||||
def self.has_passkeys(**options, &block)
|
def self.has_passkeys(**options, &block)
|
||||||
include ActionPack::Passkey::Holder
|
include ActionPack::Passkey::Holder
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class ActionPack::WebAuthn::PublicKeyCredential::CreationOptions < ActionPack::W
|
|||||||
attribute :id
|
attribute :id
|
||||||
attribute :name
|
attribute :name
|
||||||
attribute :display_name
|
attribute :display_name
|
||||||
attribute :resident_key, default: :preferred
|
attribute :resident_key, default: :required
|
||||||
attribute :exclude_credentials, default: -> { [] }
|
attribute :exclude_credentials, default: -> { [] }
|
||||||
attribute :attestation, default: :none
|
attribute :attestation, default: :none
|
||||||
attribute :challenge_expiration, default: -> { Rails.configuration.action_pack.web_authn.creation_challenge_expiration }
|
attribute :challenge_expiration, default: -> { Rails.configuration.action_pack.web_authn.creation_challenge_expiration }
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ class ActionPack::WebAuthn::PublicKeyCredential::CreationOptionsTest < ActiveSup
|
|||||||
{ type: "public-key", alg: -257 }
|
{ type: "public-key", alg: -257 }
|
||||||
], @options.as_json[:pubKeyCredParams]
|
], @options.as_json[:pubKeyCredParams]
|
||||||
|
|
||||||
assert_equal "preferred", @options.as_json[:authenticatorSelection][:residentKey]
|
assert_equal "required", @options.as_json[:authenticatorSelection][:residentKey]
|
||||||
assert_equal false, @options.as_json[:authenticatorSelection][:requireResidentKey]
|
assert_equal true, @options.as_json[:authenticatorSelection][:requireResidentKey]
|
||||||
assert_equal "preferred", @options.as_json[:authenticatorSelection][:userVerification]
|
assert_equal "preferred", @options.as_json[:authenticatorSelection][:userVerification]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user