Module: Remotus::Auth
- Defined in:
- lib/remotus/auth.rb,
lib/remotus/auth/store.rb,
lib/remotus/auth/credential.rb,
lib/remotus/auth/hash_store.rb
Overview
Module containing remote authentication classes and modules
Defined Under Namespace
Classes: Credential, HashStore, Store
Class Method Summary collapse
-
.cache ⇒ Hash{String => Remotus::Auth::Credential}
Gets the credential cache.
-
.clear_cache ⇒ Object
Clears all entries in the credential cache.
-
.credential(connection, **options) ⇒ Remotus::Auth::Credential
Gets authentication credentials for the given connection and options.
-
.stores ⇒ Array<Remotus::Auth::Store>
Gets the list of associated credential stores.
-
.stores=(stores) ⇒ Object
Sets the list of associated credential stores.
Class Method Details
.cache ⇒ Hash{String => Remotus::Auth::Credential}
Gets the credential cache
35 36 37 |
# File 'lib/remotus/auth.rb', line 35 def self.cache @cache ||= {} end |
.clear_cache ⇒ Object
Clears all entries in the credential cache
42 43 44 |
# File 'lib/remotus/auth.rb', line 42 def self.clear_cache @cache = {} end |
.credential(connection, **options) ⇒ Remotus::Auth::Credential
Gets authentication credentials for the given connection and options
20 21 22 23 24 25 26 27 28 |
# File 'lib/remotus/auth.rb', line 20 def self.credential(connection, **) # Only return cached credentials that have a populated user and password, otherwise attempt retrieval return cache[connection.host] if cache.key?(connection.host) && cache[connection.host].user && cache[connection.host].password found_credential = credential_from_stores(connection, **) return found_credential if found_credential raise Remotus::MissingCredential, "Could not find credential for #{connection.host} in any credential store (#{stores.join(", ")})." end |
.stores ⇒ Array<Remotus::Auth::Store>
Gets the list of associated credential stores
51 52 53 |
# File 'lib/remotus/auth.rb', line 51 def self.stores @stores ||= [] end |
.stores=(stores) ⇒ Object
Sets the list of associated credential stores
60 61 62 |
# File 'lib/remotus/auth.rb', line 60 def self.stores=(stores) @stores = stores end |