Class: Utcp::Auth::Basic

Inherits:
Base
  • Object
show all
Defined in:
lib/utcp/auth.rb

Instance Method Summary collapse

Methods inherited from Base

#apply_query

Constructor Details

#initialize(username:, password:) ⇒ Basic



44
45
46
# File 'lib/utcp/auth.rb', line 44

def initialize(username:, password:)
  @cred = Base64.strict_encode64("#{Utils::Subst.apply(username)}:#{Utils::Subst.apply(password)}")
end

Instance Method Details

#apply_headers(h) ⇒ Object



48
49
50
51
# File 'lib/utcp/auth.rb', line 48

def apply_headers(h)
  h["Authorization"] = "Basic #{@cred}"
  h
end