Class: RailsMFA::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rails_mfa/configuration.rb', line 7

def initialize
  # These lambdas are defined by the host app
  @sms_provider = nil   # -> lambda: ->(to, message) { ... }
  @email_provider = nil # -> lambda: ->(to, subject, body) { ... }

  # Use Rails.cache by default if Rails is loaded
  @token_store = defined?(Rails) && Rails.respond_to?(:cache) ? Rails.cache : SimpleStore.new

  @code_expiry_seconds = 300 # 5 minutes
  @code_length = 6
end

Instance Attribute Details

#code_expiry_secondsObject

Returns the value of attribute code_expiry_seconds.



5
6
7
# File 'lib/rails_mfa/configuration.rb', line 5

def code_expiry_seconds
  @code_expiry_seconds
end

#code_lengthObject

Returns the value of attribute code_length.



5
6
7
# File 'lib/rails_mfa/configuration.rb', line 5

def code_length
  @code_length
end

#email_providerObject

Returns the value of attribute email_provider.



5
6
7
# File 'lib/rails_mfa/configuration.rb', line 5

def email_provider
  @email_provider
end

#sms_providerObject

Returns the value of attribute sms_provider.



5
6
7
# File 'lib/rails_mfa/configuration.rb', line 5

def sms_provider
  @sms_provider
end

#token_storeObject

Returns the value of attribute token_store.



5
6
7
# File 'lib/rails_mfa/configuration.rb', line 5

def token_store
  @token_store
end