class Bandwidth::MultiFactorAuthBasicAuth

Utility class for basic authorization.

Public Class Methods

apply(config, http_request) click to toggle source

Add basic authentication to the request. @param [HttpRequest] The HttpRequest object to which authentication will be added.

# File lib/bandwidth/http/auth/multi_factor_auth_basic_auth.rb, line 14
def self.apply(config, http_request)
  username = config.multi_factor_auth_basic_auth_user_name
  password = config.multi_factor_auth_basic_auth_password
  value = Base64.strict_encode64("#{username}:#{password}")
  header_value = "Basic #{value}"
  http_request.headers['Authorization'] = header_value
end