Method: CF::UAA::Http.basic_auth

Defined in:
lib/uaa/http.rb

.basic_auth(name, password) ⇒ String

Constructs an http basic authentication header.

Returns:

  • (String)


68
69
70
71
72
# File 'lib/uaa/http.rb', line 68

def self.basic_auth(name, password)
  str = "#{name}:#{password}"
  "Basic " + (Base64.respond_to?(:strict_encode64)?
      Base64.strict_encode64(str): [str].pack("m").gsub(/\n/, ''))
end