summaryrefslogtreecommitdiff
path: root/lib/mixlib/authentication/signatureverification.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mixlib/authentication/signatureverification.rb')
-rw-r--r--lib/mixlib/authentication/signatureverification.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/mixlib/authentication/signatureverification.rb b/lib/mixlib/authentication/signatureverification.rb
index 842fc1f..898e05b 100644
--- a/lib/mixlib/authentication/signatureverification.rb
+++ b/lib/mixlib/authentication/signatureverification.rb
@@ -76,7 +76,7 @@ module Mixlib
# X-Ops-Content-Hash:
# X-Ops-Authorization-#{line_number}
def authenticate_request(user_secret, time_skew = (15 * 60))
- Mixlib::Authentication::Log.debug "Initializing header auth : #{request.inspect}"
+ Mixlib::Authentication.logger.debug "Initializing header auth : #{request.inspect}"
@user_secret = user_secret
@allowed_time_skew = time_skew # in seconds
@@ -150,14 +150,14 @@ module Mixlib
end
# Keep the debug messages lined up so it's easy to scan them
- Mixlib::Authentication::Log.debug("Verifying request signature:")
- Mixlib::Authentication::Log.debug(" Expected Block is: '#{candidate_block}'")
- Mixlib::Authentication::Log.debug("Decrypted block is: '#{request_decrypted_block}'")
- Mixlib::Authentication::Log.debug("Signatures match? : '#{@valid_signature}'")
+ Mixlib::Authentication.logger.debug("Verifying request signature:")
+ Mixlib::Authentication.logger.debug(" Expected Block is: '#{candidate_block}'")
+ Mixlib::Authentication.logger.debug("Decrypted block is: '#{request_decrypted_block}'")
+ Mixlib::Authentication.logger.debug("Signatures match? : '#{@valid_signature}'")
@valid_signature
rescue => e
- Mixlib::Authentication::Log.debug("Failed to verify request signature: #{e.class.name}: #{e.message}")
+ Mixlib::Authentication.logger.debug("Failed to verify request signature: #{e.class.name}: #{e.message}")
@valid_signature = false
end
@@ -169,9 +169,9 @@ module Mixlib
@valid_content_hash = (content_hash == hashed_body)
# Keep the debug messages lined up so it's easy to scan them
- Mixlib::Authentication::Log.debug("Expected content hash is: '#{hashed_body}'")
- Mixlib::Authentication::Log.debug(" Request Content Hash is: '#{content_hash}'")
- Mixlib::Authentication::Log.debug(" Hashes match?: #{@valid_content_hash}")
+ Mixlib::Authentication.logger.debug("Expected content hash is: '#{hashed_body}'")
+ Mixlib::Authentication.logger.debug(" Request Content Hash is: '#{content_hash}'")
+ Mixlib::Authentication.logger.debug(" Hashes match?: #{@valid_content_hash}")
@valid_content_hash
end
@@ -211,11 +211,11 @@ module Mixlib
# Any file that's included in the request is hashed if it's there. Otherwise,
# we hash the body.
if file_param
- Mixlib::Authentication::Log.debug "Digesting file_param: '#{file_param.inspect}'"
+ Mixlib::Authentication.logger.debug "Digesting file_param: '#{file_param.inspect}'"
@hashed_body = digester.hash_file(file_param, digest)
else
body = request.raw_post
- Mixlib::Authentication::Log.debug "Digesting body: '#{body}'"
+ Mixlib::Authentication.logger.debug "Digesting body: '#{body}'"
@hashed_body = digester.hash_string(body, digest)
end
end
@@ -232,7 +232,7 @@ module Mixlib
def timestamp_within_bounds?(time1, time2)
time_diff = (time2 - time1).abs
is_allowed = (time_diff < @allowed_time_skew)
- Mixlib::Authentication::Log.debug "Request time difference: #{time_diff}, within #{@allowed_time_skew} seconds? : #{!!is_allowed}"
+ Mixlib::Authentication.logger.debug "Request time difference: #{time_diff}, within #{@allowed_time_skew} seconds? : #{!!is_allowed}"
is_allowed
end
end