Class: Dawupxlrgo::BasicAuth

Inherits:
Object
  • Object
show all
Defined in:
lib/dawupxlrgo/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



14
15
16
17
18
19
20
# File 'lib/dawupxlrgo/http/auth/basic_auth.rb', line 14

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