Class: Raas::BasicAuth

Inherits:
Object
  • Object
show all
Defined in:
lib/raas/http/auth/basic_auth.rb

Overview

Utility class for basic authorization.

Class Method Summary collapse

Class Method Details

.apply(http_request) ⇒ Object

Add basic authentication to the request. be added.

Parameters:

  • The (HttpRequest)

    HttpRequest object to which authentication will



12
13
14
15
16
17
18
# File 'lib/raas/http/auth/basic_auth.rb', line 12

def self.apply(http_request)
  username = Configuration.platform_name
  password = Configuration.platform_key
  value = Base64.strict_encode64("#{username}:#{password}")
  header_value = "Basic #{value}"
  http_request.headers['Authorization'] = header_value
end