Sha256: 251cc1d9d0f0649187942648cd9864d55b1c2dc7994c6b5aff10b8d396ababba
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
module ApiAuth module RequestDrivers class BixbyRequest include ApiAuth::Helpers def initialize(request) @request = request @headers = request.headers true end def set_auth_header(header) @headers["Authorization"] = header @request end def calculated_md5 Digest::MD5.base64digest(@request.body || '') end def populate_content_md5 # Should *always* be a POST! @headers["Content-MD5"] = calculated_md5 end def md5_mismatch? calculated_md5 != content_md5 end def content_type value = @headers["Content-Type"] value.nil? ? "" : value end def content_md5 value = @headers["Content-MD5"] value.nil? ? "" : value end def request_uri @request.path end def set_date @request.headers["Date"] = time_as_httpdate end def timestamp value = @headers["Date"] value.nil? ? "" : value end def authorization_header @headers["Authorization"] end end drivers["Bixby::SignedJsonRequest"] = BixbyRequest end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bixby-auth-0.1.1 | lib/api_auth/request_drivers/bixby_request.rb |
bixby-auth-0.1.0 | lib/api_auth/request_drivers/bixby_request.rb |