Class: Sorcery::Model::Config
- Inherits:
-
Object
- Object
- Sorcery::Model::Config
- Defined in:
- lib/sorcery/model.rb
Overview
Each class which calls 'activate_sorcery!' receives an instance of this class. Every submodule which gets loaded may add accessors to this class so that all options will be configured from a single place.
Instance Attribute Summary (collapse)
-
- (Object) after_config
change default username attribute, for example, to use :email.
-
- (Object) before_authenticate
change default username attribute, for example, to use :email.
-
- (Object) crypted_password_attribute_name
change default username attribute, for example, to use :email.
-
- (Object) custom_encryption_provider
an array of method names to call after configuration by user.
-
- (Object) downcase_username_before_authenticating
change default username attribute, for example, to use :email.
-
- (Object) email_attribute_name
change default username attribute, for example, to use :email.
-
- (Object) encryption_algorithm
an array of method names to call after configuration by user.
-
- (Object) encryption_key
change default username attribute, for example, to use :email.
-
- (Object) encryption_provider
readonly
an array of method names to call after configuration by user.
-
- (Object) password_attribute_name
change default username attribute, for example, to use :email.
-
- (Object) salt_attribute_name
change default username attribute, for example, to use :email.
-
- (Object) salt_join_token
change default username attribute, for example, to use :email.
-
- (Object) stretches
change default username attribute, for example, to use :email.
-
- (Object) subclasses_inherit_config
change default username attribute, for example, to use :email.
-
- (Object) submodules
change default username attribute, for example, to use :email.
-
- (Object) username_attribute_names
change default username attribute, for example, to use :email.
Instance Method Summary (collapse)
-
- (Config) initialize
constructor
change default encryption_provider.
-
- (Object) reset!
Resets all configuration options to their default values.
Constructor Details
- (Config) initialize
change default encryption_provider. use an external encryption class. encryption algorithm name. See 'encryption_algorithm=' below for available options.
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/sorcery/model.rb', line 230 def initialize @defaults = { :@submodules => [], :@username_attribute_names => [:username], :@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 => [] } reset! end |
Instance Attribute Details
- (Object) after_config
change default username attribute, for example, to use :email
198 199 200 |
# File 'lib/sorcery/model.rb', line 198 def after_config @after_config end |
- (Object) before_authenticate
change default username attribute, for example, to use :email
198 199 200 |
# File 'lib/sorcery/model.rb', line 198 def before_authenticate @before_authenticate end |
- (Object) crypted_password_attribute_name
change default username attribute, for example, to use :email
198 199 200 |
# File 'lib/sorcery/model.rb', line 198 def crypted_password_attribute_name @crypted_password_attribute_name end |
- (Object) custom_encryption_provider
an array of method names to call after configuration by user. used internally.
225 226 227 |
# File 'lib/sorcery/model.rb', line 225 def custom_encryption_provider @custom_encryption_provider end |
- (Object) downcase_username_before_authenticating
change default username attribute, for example, to use :email
198 199 200 |
# File 'lib/sorcery/model.rb', line 198 def downcase_username_before_authenticating @downcase_username_before_authenticating end |
- (Object) email_attribute_name
change default username attribute, for example, to use :email
198 199 200 |
# File 'lib/sorcery/model.rb', line 198 def email_attribute_name @email_attribute_name end |
- (Object) encryption_algorithm
an array of method names to call after configuration by user. used internally.
225 226 227 |
# File 'lib/sorcery/model.rb', line 225 def encryption_algorithm @encryption_algorithm end |
- (Object) encryption_key
change default username attribute, for example, to use :email
198 199 200 |
# File 'lib/sorcery/model.rb', line 198 def encryption_key @encryption_key end |
- (Object) encryption_provider (readonly)
an array of method names to call after configuration by user. used internally.
225 226 227 |
# File 'lib/sorcery/model.rb', line 225 def encryption_provider @encryption_provider end |
- (Object) password_attribute_name
change default username attribute, for example, to use :email
198 199 200 |
# File 'lib/sorcery/model.rb', line 198 def password_attribute_name @password_attribute_name end |
- (Object) salt_attribute_name
change default username attribute, for example, to use :email
198 199 200 |
# File 'lib/sorcery/model.rb', line 198 def salt_attribute_name @salt_attribute_name end |
- (Object) salt_join_token
change default username attribute, for example, to use :email
198 199 200 |
# File 'lib/sorcery/model.rb', line 198 def salt_join_token @salt_join_token end |
- (Object) stretches
change default username attribute, for example, to use :email
198 199 200 |
# File 'lib/sorcery/model.rb', line 198 def stretches @stretches end |
- (Object) subclasses_inherit_config
change default username attribute, for example, to use :email
198 199 200 |
# File 'lib/sorcery/model.rb', line 198 def subclasses_inherit_config @subclasses_inherit_config end |
- (Object) submodules
change default username attribute, for example, to use :email
198 199 200 |
# File 'lib/sorcery/model.rb', line 198 def submodules @submodules end |
- (Object) username_attribute_names
change default username attribute, for example, to use :email
198 199 200 |
# File 'lib/sorcery/model.rb', line 198 def username_attribute_names @username_attribute_names end |
Instance Method Details
- (Object) reset!
Resets all configuration options to their default values.
253 254 255 256 257 |
# File 'lib/sorcery/model.rb', line 253 def reset! @defaults.each do |k,v| instance_variable_set(k,v) end end |