diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-12-15 13:17:04 -0600 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2016-01-25 09:51:06 -0800 |
commit | d999373538ad9861ad8176d2ecd1ead02d487814 (patch) | |
tree | 5b22de7e3eecddf1bfba2402e6d0cf1b62189f98 /lib/chef | |
parent | 395324bab4a687f8e65789c77c1222beba89a586 (diff) | |
download | chef-d999373538ad9861ad8176d2ecd1ead02d487814.tar.gz |
Pass headers to mixlib-authentication
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/http/authenticator.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/chef/http/authenticator.rb b/lib/chef/http/authenticator.rb index 02074171f8..ab4804c964 100644 --- a/lib/chef/http/authenticator.rb +++ b/lib/chef/http/authenticator.rb @@ -47,8 +47,8 @@ class Chef end def handle_request(method, url, headers={}, data=false) - headers.merge!(authentication_headers(method, url, data)) if sign_requests? headers.merge!({"X-Ops-Server-API-Version" => @api_version}) + headers.merge!(authentication_headers(method, url, data, headers)) if sign_requests? [method, url, headers, data] end @@ -90,12 +90,17 @@ class Chef raise Chef::Exceptions::InvalidPrivateKey, msg end - def authentication_headers(method, url, json_body=nil) - request_params = {:http_method => method, :path => url.path, :body => json_body, :host => "#{url.host}:#{url.port}"} + def authentication_headers(method, url, json_body=nil, headers=nil) + request_params = { + :http_method => method, + :path => url.path, + :body => json_body, + :host => "#{url.host}:#{url.port}", + :headers => headers, + } request_params[:body] ||= "" auth_credentials.signature_headers(request_params) end - end end end |