class Remotus::Auth::HashStore
Hash-based authentication store that requires credentials to be added manually
Public Class Methods
Creates the HashStore
# File lib/remotus/auth/hash_store.rb, line 10 def initialize super @store = {} end
Public Instance Methods
Adds a credential to the store for a given connection
@param [Remotus::SshConnection, Remotus::WinrmConnection
, host] connection associated connection @param [Remotus::Auth::Credential] credential new credential
# File lib/remotus/auth/hash_store.rb, line 33 def add(connection, credential) @store[connection.host.downcase] = credential end
Retrieves a credential from the hash store
@param [Remotus::SshConnection, Remotus::WinrmConnection
, host] connection associated connection @param [Hash] _options unused options hash
@return [Remotus::Auth::Credential, nil] found credential or nil
# File lib/remotus/auth/hash_store.rb, line 23 def credential(connection, **_options) @store[connection.host.downcase] end
Removes a credential from the store for a given connection
@param [Remotus::SshConnection, Remotus::WinrmConnection
, host] connection associated connection
# File lib/remotus/auth/hash_store.rb, line 42 def remove(connection) @store.delete(connection.host.downcase) end
String representation of the hash store
@return [String] string representation of the hash store
# File lib/remotus/auth/hash_store.rb, line 51 def to_s "HashStore" end