lib/api_auth/request_drivers/rack.rb in api-auth-2.4.1 vs lib/api_auth/request_drivers/rack.rb in api-auth-2.5.0
- old
+ new
@@ -13,30 +13,30 @@
@request.env['Authorization'] = header
fetch_headers
@request
end
- def calculated_md5
+ def calculated_hash
if @request.body
body = @request.body.read
@request.body.rewind
else
body = ''
end
- md5_base64digest(body)
+ sha256_base64digest(body)
end
- def populate_content_md5
+ def populate_content_hash
return unless %w[POST PUT].include?(@request.request_method)
- @request.env['Content-MD5'] = calculated_md5
+ @request.env['X-Authorization-Content-SHA256'] = calculated_hash
fetch_headers
end
- def md5_mismatch?
+ def content_hash_mismatch?
if %w[POST PUT].include?(@request.request_method)
- calculated_md5 != content_md5
+ calculated_hash != content_hash
else
false
end
end
@@ -50,11 +50,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 HTTP-CONTENT-MD5 HTTP_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