Sha256: 4ee1f2af9c40e47c3aaaaf667836a04e68626362310e91939a46797fad7d09ae
Contents?: true
Size: 1012 Bytes
Versions: 20
Compression:
Stored size: 1012 Bytes
Contents
# frozen_string_literal: true module ProxyRb # Fetch password for user... module PasswordFetchers # ... process environment class BasicPasswordFetcher def call(_user_name) raise NotImplementedError, 'You need to implement `#call` for a valid password fetcher' end private def read(_string) raise NotImplementedError, 'You need to implement `#read` for a valid password fetcher' end # @param [String] user_name # # @raise [ArgumentError] # Raised if password cannot be retrieved for user # # @return [String] # The password def fetch_password_for_user(user_name) if read(user_name.upcase) read(user_name.upcase) elsif read(user_name.downcase) read(user_name.downcase) elsif read(user_name) read(user_name) else raise ArgumentError, %(Failed to fetch password for username "#{user_name}") end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems