summaryrefslogtreecommitdiff
path: root/lib/mixlib/authentication/signedheaderauth.rb
diff options
context:
space:
mode:
authorTim Hinderliter <tim@opscode.com>2009-11-03 18:44:43 -0800
committerTim Hinderliter <tim@opscode.com>2009-11-03 18:44:43 -0800
commitc38ca86e2e79737f5bb7c67b83f15a2dec61a2ea (patch)
treec29b92b1d0b5dcae2335d5368866a9a54b7107b4 /lib/mixlib/authentication/signedheaderauth.rb
parenteda2b502133b23dc8f90eba2654d19e87a63140a (diff)
downloadmixlib-authentication-PL-316.tar.gz
fixed PL-316 - now splitting Authorization header into multiple headers X-Ops-Authorization-1, ...PL-316
Diffstat (limited to 'lib/mixlib/authentication/signedheaderauth.rb')
-rw-r--r--lib/mixlib/authentication/signedheaderauth.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/mixlib/authentication/signedheaderauth.rb b/lib/mixlib/authentication/signedheaderauth.rb
index 84607f9..d69ea7e 100644
--- a/lib/mixlib/authentication/signedheaderauth.rb
+++ b/lib/mixlib/authentication/signedheaderauth.rb
@@ -33,14 +33,22 @@ module Mixlib
digester.hash_body(self.body)
end
- signature = Base64.encode64(private_key.private_encrypt(canonicalize_request)).chomp.gsub!(/\n/,"\n\t")
header_hash = {
"X-Ops-Sign" => SIGNING_DESCRIPTION,
"X-Ops-Userid" => user_id,
"X-Ops-Timestamp" => canonical_time,
"X-Ops-Content-Hash" =>@hashed_body,
- "Authorization" => signature,
}
+
+ # Our multiline hash for authorization will be encoded in multiple header
+ # lines - X-Ops-Authorization-1, ... (starts at 1, not 0!)
+ signature = Base64.encode64(private_key.private_encrypt(canonicalize_request)).chomp
+ signature_lines = signature.split(/\n/)
+ signature_lines.each_index do |idx|
+ key = "X-Ops-Authorization-#{idx + 1}"
+ header_hash[key] = signature_lines[idx]
+ end
+
Mixlib::Authentication::Log.debug "Header hash: #{header_hash.inspect}"
header_hash