lib/api_auth/request_drivers/httpi.rb in api-auth-2.4.1 vs lib/api_auth/request_drivers/httpi.rb in api-auth-2.5.0

- old
+ new

@@ -13,24 +13,24 @@ @request.headers['Authorization'] = header fetch_headers @request end - def calculated_md5 - md5_base64digest(@request.body || '') + def calculated_hash + sha256_base64digest(@request.body || '') end - def populate_content_md5 + def populate_content_hash return unless @request.body - @request.headers['Content-MD5'] = calculated_md5 + @request.headers['X-Authorization-Content-SHA256'] = calculated_hash fetch_headers end - def md5_mismatch? + def content_hash_mismatch? if @request.body - calculated_md5 != content_md5 + calculated_hash != content_hash else false end end @@ -44,11 +44,11 @@ def content_type find_header(%w[CONTENT-TYPE CONTENT_TYPE HTTP_CONTENT_TYPE]) end - def content_md5 - find_header(%w[CONTENT-MD5 CONTENT_MD5]) + def content_hash + find_header(%w[X-AUTHORIZATION-CONTENT-SHA256]) end def original_uri find_header(%w[X-ORIGINAL-URI X_ORIGINAL_URI HTTP_X_ORIGINAL_URI]) end