signature-acd 0.1.10 → 0.1.11

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7987e7c51751a69866f925f5f219b6285804ec3
4
- data.tar.gz: 6831aed39ab6b5c072caf19ffd7174aa6bf81d3e
3
+ metadata.gz: 2cd79059dee3c952532a5b0ee029e3aeade4d270
4
+ data.tar.gz: 9856979b8e32d931a44120a31d571b313dde2ea5
5
5
  SHA512:
6
- metadata.gz: 7019b7eb991aa110fa3ce68019482bb32220ee20e67df2faaa3a64e1df0c213c661f6fbcb93bb93c03e3f2c00f9533c4a639832a510121903233180005065098
7
- data.tar.gz: 6b64c6d445724a9c092da03c893b4c3320567a5bb28686248cd9cc6a3f25d1960dc88d5c7ea3e8a1b8a0d61ef8ba5544a0cebefbf95e680c0cd74e0a9583d5c8
6
+ metadata.gz: 5270e2afbf5ef9c9e58220e5c28018240ebc71d82fedc6213e80fc8a6fe2bbcf812df148d36e64439841067f1ba4325ba02dbb42d602ed02940be20525dfa95c
7
+ data.tar.gz: 1651658443a3b8db5e5e7c49d259c0e7da10b97cb8cc28317bb5aac7d50bfae67162e56ca0760fce589011e37545a648dd6532685c2a72c02aba5698c62048a5
@@ -36,7 +36,9 @@ module Signature
36
36
  hh = {}
37
37
  headers.each do |k,v|
38
38
  if match = k.upcase.match(AUTH_HEADER_PREFIX_REGEX)
39
- hh[match[1].downcase.gsub!('-', '_')] = v
39
+ mindex = match[1] if match[1]
40
+ mindex ||= match[2]
41
+ hh[mindex.downcase.gsub!('-', '_')] = v if mindex
40
42
  end
41
43
  end
42
44
  hh
@@ -1,3 +1,3 @@
1
1
  module Signature
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
3
3
  end
@@ -2,7 +2,7 @@ require File.expand_path('../spec_helper', __FILE__)
2
2
 
3
3
  describe Signature do
4
4
  before :each do
5
- Time.stub!(:now).and_return(Time.at(1234))
5
+ Time.stub(:now).and_return(Time.at(1234))
6
6
 
7
7
  @token = Signature::Token.new('key', 'secret')
8
8
 
@@ -178,15 +178,15 @@ describe Signature do
178
178
 
179
179
  it "should raise error if timestamp has expired (default of 600s)" do
180
180
  request = Signature::Request.new('POST', '/some/path', @params)
181
- Time.stub!(:now).and_return(Time.at(1234 + 599))
181
+ Time.stub(:now).and_return(Time.at(1234 + 599))
182
182
  request.authenticate_by_token!(@token).should == true
183
- Time.stub!(:now).and_return(Time.at(1234 - 599))
183
+ Time.stub(:now).and_return(Time.at(1234 - 599))
184
184
  request.authenticate_by_token!(@token).should == true
185
- Time.stub!(:now).and_return(Time.at(1234 + 600))
185
+ Time.stub(:now).and_return(Time.at(1234 + 600))
186
186
  lambda {
187
187
  request.authenticate_by_token!(@token)
188
188
  }.should raise_error("Timestamp expired: Given timestamp (1970-01-01T00:20:34Z) not within 600s of server time (1970-01-01T00:30:34Z)")
189
- Time.stub!(:now).and_return(Time.at(1234 - 600))
189
+ Time.stub(:now).and_return(Time.at(1234 - 600))
190
190
  lambda {
191
191
  request.authenticate_by_token!(@token)
192
192
  }.should raise_error("Timestamp expired: Given timestamp (1970-01-01T00:20:34Z) not within 600s of server time (1970-01-01T00:10:34Z)")
@@ -195,9 +195,9 @@ describe Signature do
195
195
  it "should be possible to customize the timeout grace period" do
196
196
  grace = 10
197
197
  request = Signature::Request.new('POST', '/some/path', @params)
198
- Time.stub!(:now).and_return(Time.at(1234 + grace - 1))
198
+ Time.stub(:now).and_return(Time.at(1234 + grace - 1))
199
199
  request.authenticate_by_token!(@token, grace).should == true
200
- Time.stub!(:now).and_return(Time.at(1234 + grace))
200
+ Time.stub(:now).and_return(Time.at(1234 + grace))
201
201
  lambda {
202
202
  request.authenticate_by_token!(@token, grace)
203
203
  }.should raise_error("Timestamp expired: Given timestamp (1970-01-01T00:20:34Z) not within 10s of server time (1970-01-01T00:20:44Z)")
@@ -205,7 +205,7 @@ describe Signature do
205
205
 
206
206
  it "should be possible to skip timestamp check by passing nil" do
207
207
  request = Signature::Request.new('POST', '/some/path', @params)
208
- Time.stub!(:now).and_return(Time.at(1234 + 1000))
208
+ Time.stub(:now).and_return(Time.at(1234 + 1000))
209
209
  request.authenticate_by_token!(@token, nil).should == true
210
210
  end
211
211
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: signature-acd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Hanson