crashlog-auth-hmac 1.1.5 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock
CHANGED
data/lib/crash_log/auth_hmac.rb
CHANGED
@@ -96,15 +96,15 @@ module CrashLog
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def content_type(headers)
|
99
|
-
find_header(%w(CONTENT-TYPE CONTENT_TYPE HTTP_CONTENT_TYPE), headers)
|
99
|
+
find_header(%w(CONTENT-TYPE CONTENT_TYPE HTTP_CONTENT_TYPE content-type), headers)
|
100
100
|
end
|
101
101
|
|
102
102
|
def date(headers)
|
103
|
-
find_header(%w(DATE HTTP_DATE), headers)
|
103
|
+
find_header(%w(DATE HTTP_DATE date), headers)
|
104
104
|
end
|
105
105
|
|
106
106
|
def content_md5(headers)
|
107
|
-
find_header(%w(CONTENT-MD5 CONTENT_MD5), headers)
|
107
|
+
find_header(%w(CONTENT-MD5 CONTENT_MD5 content-md5), headers)
|
108
108
|
end
|
109
109
|
|
110
110
|
def request_path(request)
|
@@ -230,7 +230,8 @@ module CrashLog
|
|
230
230
|
|
231
231
|
def signature(request, secret)
|
232
232
|
digest = OpenSSL::Digest::Digest.new('sha1')
|
233
|
-
|
233
|
+
string = canonical_string(request)
|
234
|
+
Base64.strict_encode64(OpenSSL::HMAC.digest(digest, secret, string)).strip
|
234
235
|
end
|
235
236
|
|
236
237
|
def canonical_string(request)
|
@@ -34,14 +34,19 @@ describe CrashLog::AuthHMAC do
|
|
34
34
|
Delorean.time_travel_to(Date.parse("Thu, 10 Jul 2008 03:29:56 GMT"))
|
35
35
|
|
36
36
|
request_hash = {
|
37
|
-
'REQUEST_METHOD' => '
|
37
|
+
'REQUEST_METHOD' => 'PUT',
|
38
38
|
'content-type' => 'text/plain',
|
39
39
|
'content-md5' => 'blahblah',
|
40
40
|
'date' => "Thu, 10 Jul 2008 03:29:56 GMT",
|
41
41
|
'PATH_INFO' => '/notify'
|
42
42
|
}
|
43
43
|
|
44
|
+
standard_request = Net::HTTP::Put.new("/notify",
|
45
|
+
'content-type' => 'text/plain',
|
46
|
+
'content-md5' => 'blahblah',
|
47
|
+
'date' => "Thu, 10 Jul 2008 03:29:56 GMT")
|
48
|
+
|
44
49
|
sig = CrashLog::AuthHMAC.signature(request_hash, 'secret')
|
45
|
-
sig.should == '
|
50
|
+
sig.should == CrashLog::AuthHMAC.signature(standard_request, 'secret')
|
46
51
|
end
|
47
52
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crashlog-auth-hmac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-04 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A Ruby Gem for authenticating HTTP requests using a HMAC
|
15
15
|
email:
|