Class: SuggestGrid::BasicAuth
- Inherits:
-
Object
- Object
- SuggestGrid::BasicAuth
- Defined in:
- lib/suggestgrid/http/auth/basic_auth.rb
Overview
Utility class for basic authorization.
Class Method Summary collapse
-
.apply(http_request) ⇒ Object
Add basic authentication to the request.
Class Method Details
.apply(http_request) ⇒ Object
Add basic authentication to the request. be added.
12 13 14 15 16 17 18 |
# File 'lib/suggestgrid/http/auth/basic_auth.rb', line 12 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 |