class Remotus::Auth::HashStore

Hash-based authentication store that requires credentials to be added manually

Public Class Methods

new() click to toggle source

Creates the HashStore

Calls superclass method
# File lib/remotus/auth/hash_store.rb, line 10
def initialize
  super
  @store = {}
end

Public Instance Methods

add(connection, credential) click to toggle source

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
credential(connection, **_options) click to toggle source

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
remove(connection) click to toggle source

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
to_s() click to toggle source

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