Class: WebAuthn::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/webauthn/configuration.rb

Constant Summary collapse

DEFAULT_ALGORITHMS =
["ES256", if_pss_supported("PS256"), "RS256"].compact.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



36
37
38
39
40
41
42
43
44
# File 'lib/webauthn/configuration.rb', line 36

def initialize
  @algorithms = DEFAULT_ALGORITHMS.dup
  @encoding = WebAuthn::Encoder::STANDARD_ENCODING
  @verify_attestation_statement = true
  @credential_options_timeout = 120000
  @silent_authentication = false
  @acceptable_attestation_types = ['None', 'Self', 'Basic', 'AttCA', 'Basic_or_AttCA']
  @attestation_root_certificates_finders = []
end

Instance Attribute Details

#acceptable_attestation_typesObject

Returns the value of attribute acceptable_attestation_types.



33
34
35
# File 'lib/webauthn/configuration.rb', line 33

def acceptable_attestation_types
  @acceptable_attestation_types
end

#algorithmsObject

Returns the value of attribute algorithms.



25
26
27
# File 'lib/webauthn/configuration.rb', line 25

def algorithms
  @algorithms
end

#attestation_root_certificates_findersObject

Returns the value of attribute attestation_root_certificates_finders.



34
35
36
# File 'lib/webauthn/configuration.rb', line 34

def attestation_root_certificates_finders
  @attestation_root_certificates_finders
end

#credential_options_timeoutObject

Returns the value of attribute credential_options_timeout.



31
32
33
# File 'lib/webauthn/configuration.rb', line 31

def credential_options_timeout
  @credential_options_timeout
end

#encodingObject

Returns the value of attribute encoding.



26
27
28
# File 'lib/webauthn/configuration.rb', line 26

def encoding
  @encoding
end

#originObject

Returns the value of attribute origin.



27
28
29
# File 'lib/webauthn/configuration.rb', line 27

def origin
  @origin
end

#rp_idObject

Returns the value of attribute rp_id.



28
29
30
# File 'lib/webauthn/configuration.rb', line 28

def rp_id
  @rp_id
end

#rp_nameObject

Returns the value of attribute rp_name.



29
30
31
# File 'lib/webauthn/configuration.rb', line 29

def rp_name
  @rp_name
end

#silent_authenticationObject

Returns the value of attribute silent_authentication.



32
33
34
# File 'lib/webauthn/configuration.rb', line 32

def silent_authentication
  @silent_authentication
end

#verify_attestation_statementObject

Returns the value of attribute verify_attestation_statement.



30
31
32
# File 'lib/webauthn/configuration.rb', line 30

def verify_attestation_statement
  @verify_attestation_statement
end

Class Method Details

.if_pss_supported(algorithm) ⇒ Object



19
20
21
# File 'lib/webauthn/configuration.rb', line 19

def self.if_pss_supported(algorithm)
  OpenSSL::PKey::RSA.instance_methods.include?(:verify_pss) ? algorithm : nil
end

Instance Method Details

#encoderObject

This is the user-data encoder. Used to decode user input and to encode data provided to the user.



48
49
50
# File 'lib/webauthn/configuration.rb', line 48

def encoder
  @encoder ||= WebAuthn::Encoder.new(encoding)
end