diff options
author | Thom May <thom@chef.io> | 2016-06-08 11:25:56 +0100 |
---|---|---|
committer | Thom May <thom@may.lt> | 2016-06-08 11:25:56 +0100 |
commit | 8cd4ab1ad2b48cf92b45cd980279f7d5b836892f (patch) | |
tree | b1226b3f5f56a05ed34bc7d55422be18106b3064 /lib/mixlib/authentication/http_authentication_request.rb | |
parent | 2dffcfb7ce778efb60834c66aa1e0cd4ec500901 (diff) | |
download | mixlib-authentication-8cd4ab1ad2b48cf92b45cd980279f7d5b836892f.tar.gz |
Chefstyle and modernisev1.4.1
Signed-off-by: Thom May <thom@may.lt>
Diffstat (limited to 'lib/mixlib/authentication/http_authentication_request.rb')
-rw-r--r-- | lib/mixlib/authentication/http_authentication_request.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/mixlib/authentication/http_authentication_request.rb b/lib/mixlib/authentication/http_authentication_request.rb index ad8354f..819f8f5 100644 --- a/lib/mixlib/authentication/http_authentication_request.rb +++ b/lib/mixlib/authentication/http_authentication_request.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ # limitations under the License. # -require 'mixlib/authentication' +require "mixlib/authentication" module Mixlib module Authentication @@ -33,7 +33,7 @@ module Mixlib end def headers - @headers ||= @request.env.inject({ }) { |memo, kv| memo[$2.gsub(/\-/,"_").downcase.to_sym] = kv[1] if kv[0] =~ /^(HTTP_)(.*)/; memo } + @headers ||= @request.env.inject({}) { |memo, kv| memo[$2.tr("-", "_").downcase.to_sym] = kv[1] if kv[0] =~ /^(HTTP_)(.*)/; memo } end def http_method @@ -70,13 +70,12 @@ module Mixlib def request_signature unless @request_signature - @request_signature = headers.find_all { |h| h[0].to_s =~ /^x_ops_authorization_/ }.sort { |x,y| x.to_s <=> y.to_s}.map { |i| i[1] }.join("\n") + @request_signature = headers.find_all { |h| h[0].to_s =~ /^x_ops_authorization_/ }.sort { |x, y| x.to_s <=> y.to_s }.map { |i| i[1] }.join("\n") Mixlib::Authentication::Log.debug "Reconstituted (user-supplied) request signature: #{@request_signature}" end @request_signature end - def validate_headers! missing_headers = MANDATORY_HEADERS - headers.keys unless missing_headers.empty? |