Class: Remotus::Auth::HashStore
- Defined in:
- lib/remotus/auth/hash_store.rb
Overview
Hash-based authentication store that requires credentials to be added manually
Instance Method Summary collapse
-
#add(connection, credential) ⇒ Object
Adds a credential to the store for a given connection.
-
#credential(connection, **_options) ⇒ Remotus::Auth::Credential?
Retrieves a credential from the hash store.
-
#initialize ⇒ HashStore
constructor
Creates the HashStore.
-
#remove(connection) ⇒ Object
Removes a credential from the store for a given connection.
-
#to_s ⇒ String
String representation of the hash store.
Methods inherited from Store
Constructor Details
#initialize ⇒ HashStore
Creates the HashStore
10 11 12 13 |
# File 'lib/remotus/auth/hash_store.rb', line 10 def initialize super @store = {} end |
Instance Method Details
#add(connection, credential) ⇒ Object
Adds a credential to the store for a given connection
33 34 35 |
# File 'lib/remotus/auth/hash_store.rb', line 33 def add(connection, credential) @store[connection.host.downcase] = credential end |
#credential(connection, **_options) ⇒ Remotus::Auth::Credential?
Retrieves a credential from the hash store
23 24 25 |
# File 'lib/remotus/auth/hash_store.rb', line 23 def credential(connection, **) @store[connection.host.downcase] end |
#remove(connection) ⇒ Object
Removes a credential from the store for a given connection
42 43 44 |
# File 'lib/remotus/auth/hash_store.rb', line 42 def remove(connection) @store.delete(connection.host.downcase) end |
#to_s ⇒ String
String representation of the hash store
51 52 53 |
# File 'lib/remotus/auth/hash_store.rb', line 51 def to_s "HashStore" end |