Class: Steppe::Auth::Basic::SimpleUserPasswordStore

Inherits:
Object
  • Object
show all
Defined in:
lib/steppe/auth/basic.rb

Overview

Simple hash-based credentials store implementation. Stores username/password pairs in memory.

Examples:

store = SimpleUserPasswordStore.new({
  'joe' => 'secret123',
  'anna' => 'password456'
})

Constant Summary collapse

HashInterface =

Interface for hash-based credentials stores (Hash[String => String]). Maps username strings to password strings.

Types::Hash[String, String]

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ SimpleUserPasswordStore



60
61
62
# File 'lib/steppe/auth/basic.rb', line 60

def initialize(hash)
  @lookup = hash
end

Instance Method Details

#lookup(username) ⇒ String?

Retrieve a password by username.



68
# File 'lib/steppe/auth/basic.rb', line 68

def lookup(username) = @lookup[username.strip]