summaryrefslogtreecommitdiff
path: root/lib/mixlib/authentication/http_authentication_request.rb
diff options
context:
space:
mode:
authorDaniel DeLeo <dan@opscode.com>2010-07-21 19:58:11 -0700
committerDaniel DeLeo <dan@opscode.com>2010-07-21 19:58:11 -0700
commit48df6b6096cef7cb0c366525d82e20befcf8e345 (patch)
tree7f7527773ecf4c0b4bbd4291e6cfc9d8c898d9e7 /lib/mixlib/authentication/http_authentication_request.rb
parent4d07b23047d17e42eb4630cbc758cc2f671ee986 (diff)
downloadmixlib-authentication-48df6b6096cef7cb0c366525d82e20befcf8e345.tar.gz
[CHEF-761] initialize with the request to access normalized headers
* Can now create the signature verification object w/ the request and then access values computed by the HTTPAuthenticationRequest object. * created a #authenticate_reqest method that can be used when signature verification is initialized w/ the request * #authenticate_user_request works as before
Diffstat (limited to 'lib/mixlib/authentication/http_authentication_request.rb')
-rw-r--r--lib/mixlib/authentication/http_authentication_request.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/mixlib/authentication/http_authentication_request.rb b/lib/mixlib/authentication/http_authentication_request.rb
index 68a2611..3522149 100644
--- a/lib/mixlib/authentication/http_authentication_request.rb
+++ b/lib/mixlib/authentication/http_authentication_request.rb
@@ -24,10 +24,11 @@ module Mixlib
MANDATORY_HEADERS = [:x_ops_sign, :x_ops_userid, :x_ops_timestamp, :host, :x_ops_content_hash]
+ attr_reader :request
+
def initialize(request)
@request = request
@request_signature = nil
- assert_required_headers_present
end
def headers
@@ -70,9 +71,8 @@ module Mixlib
@request_signature
end
- private
- def assert_required_headers_present
+ def validate_headers!
missing_headers = MANDATORY_HEADERS - headers.keys
unless missing_headers.empty?
missing_headers.map! { |h| h.to_s.upcase }
@@ -80,6 +80,7 @@ module Mixlib
end
end
+
end
end
end