Class: Pasaporte::Auth::YamlTable
- Inherits:
-
Object
- Object
- Pasaporte::Auth::YamlTable
- Defined in:
- lib/pasaporte/auth/yaml_table.rb
Overview
Authenticate agains a simple YAML table of logins-passwords per domain. Don’t forget the dash to begin a new entry!
google.com:
- :login: george
:pass: foo
- :login: james
:pass: trinkle
Place the table in ‘pasaporte/users_per_domain.yml’
Direct Known Subclasses
Constant Summary collapse
Instance Attribute Summary collapse
-
#table_path ⇒ Object
Returns the value of attribute table_path.
Instance Method Summary collapse
- #call(login, pass, domain) ⇒ Object
-
#initialize ⇒ YamlTable
constructor
A new instance of YamlTable.
Constructor Details
#initialize ⇒ YamlTable
Returns a new instance of YamlTable.
19 20 21 |
# File 'lib/pasaporte/auth/yaml_table.rb', line 19 def initialize refresh end |
Instance Attribute Details
#table_path ⇒ Object
Returns the value of attribute table_path.
13 14 15 |
# File 'lib/pasaporte/auth/yaml_table.rb', line 13 def table_path @table_path end |
Instance Method Details
#call(login, pass, domain) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/pasaporte/auth/yaml_table.rb', line 23 def call(login, pass, domain) refresh d = @table[domain] return false unless d.is_a?(Array) u = d.find do | user | (user["login"] == login) && (user["pass"] == pass) end !!u end |