Class: Sorcery::Model::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/sorcery/model/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

encryption algorithm name. See 'encryption_algorithm=' below for available options.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/sorcery/model/config.rb', line 45

def initialize
  @defaults = {
    :@submodules                           => [],
    :@username_attribute_names             => [:email],
    :@password_attribute_name              => :password,
    :@downcase_username_before_authenticating => false,
    :@email_attribute_name                 => :email,
    :@crypted_password_attribute_name      => :crypted_password,
    :@encryption_algorithm                 => :bcrypt,
    :@encryption_provider                  => CryptoProviders::BCrypt,
    :@custom_encryption_provider           => nil,
    :@encryption_key                       => nil,
    :@salt_join_token                      => "",
    :@salt_attribute_name                  => :salt,
    :@stretches                            => nil,
    :@subclasses_inherit_config            => false,
    :@before_authenticate                  => [],
    :@after_config                         => [],
    :@email_delivery_method                => default_email_delivery_method,
  }
  reset!
end

Instance Attribute Details

#custom_encryption_providerObject

an array of method names to call after configuration by user. used internally.



41
42
43
# File 'lib/sorcery/model/config.rb', line 41

def custom_encryption_provider
  @custom_encryption_provider
end

#encryption_algorithmObject

an array of method names to call after configuration by user. used internally.



41
42
43
# File 'lib/sorcery/model/config.rb', line 41

def encryption_algorithm
  @encryption_algorithm
end

#encryption_providerObject (readonly)

an array of method names to call after configuration by user. used internally.



41
42
43
# File 'lib/sorcery/model/config.rb', line 41

def encryption_provider
  @encryption_provider
end

Instance Method Details

#reset!Object

Resets all configuration options to their default values.



69
70
71
72
73
# File 'lib/sorcery/model/config.rb', line 69

def reset!
  @defaults.each do |k,v|
    instance_variable_set(k,v)
  end
end

#username_attribute_names=(fields) ⇒ Object



75
76
77
# File 'lib/sorcery/model/config.rb', line 75

def username_attribute_names=(fields)
  @username_attribute_names = fields.kind_of?(Array) ? fields : [fields]
end