Class: Hector::ExpressionEngineIdentityAdapter
- Inherits:
-
Object
- Object
- Hector::ExpressionEngineIdentityAdapter
- Defined in:
- lib/hector/ee_identity_adapter.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#db ⇒ Object
readonly
Returns the value of attribute db.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Instance Method Summary collapse
- #authenticate(username, password) {|identity(normalize(username)) == hash(password)| ... } ⇒ Object
- #forget(username) ⇒ Object
-
#initialize(filename = nil) ⇒ ExpressionEngineIdentityAdapter
constructor
A new instance of ExpressionEngineIdentityAdapter.
- #normalize(username) ⇒ Object
- #remember(username, password) ⇒ Object
Constructor Details
#initialize(filename = nil) ⇒ ExpressionEngineIdentityAdapter
Returns a new instance of ExpressionEngineIdentityAdapter.
19 20 21 22 23 |
# File 'lib/hector/ee_identity_adapter.rb', line 19 def initialize(filename = nil) @filename = filename || Hector.root.join("config/expression_engine.yml") load_config load_database end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
17 18 19 |
# File 'lib/hector/ee_identity_adapter.rb', line 17 def config @config end |
#db ⇒ Object (readonly)
Returns the value of attribute db.
17 18 19 |
# File 'lib/hector/ee_identity_adapter.rb', line 17 def db @db end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
17 18 19 |
# File 'lib/hector/ee_identity_adapter.rb', line 17 def filename @filename end |
Instance Method Details
#authenticate(username, password) {|identity(normalize(username)) == hash(password)| ... } ⇒ Object
25 26 27 |
# File 'lib/hector/ee_identity_adapter.rb', line 25 def authenticate(username, password) yield identity(normalize(username)) == hash(password) end |
#forget(username) ⇒ Object
34 35 36 37 |
# File 'lib/hector/ee_identity_adapter.rb', line 34 def forget(username) Hector.logger.warn "Hector cannot manage ExpressionEngine members" false end |
#normalize(username) ⇒ Object
39 40 41 |
# File 'lib/hector/ee_identity_adapter.rb', line 39 def normalize(username) username.strip.downcase end |
#remember(username, password) ⇒ Object
29 30 31 32 |
# File 'lib/hector/ee_identity_adapter.rb', line 29 def remember(username, password) Hector.logger.warn "Hector cannot manage ExpressionEngine members" false end |