ey_api_hmac 0.4.6 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,6 +31,9 @@ module EY
31
31
  access_key_id = md[1]
32
32
  hmac = md[2]
33
33
  secret = lookup.call(access_key_id)
34
+ unless secret
35
+ raise HmacAuthFail, "Authentication failed (lookup didn't find #{access_key_id})"
36
+ end
34
37
  unless authenticated?(url, access_key_id, secret)
35
38
  raise HmacAuthFail, "Authentication failed for #{access_key_id}"
36
39
  end
@@ -1,5 +1,5 @@
1
1
  module EY
2
2
  module ApiHMAC
3
- VERSION = "0.4.6"
3
+ VERSION = "0.4.7"
4
4
  end
5
5
  end
@@ -54,6 +54,12 @@ describe EY::ApiHMAC do
54
54
  }.should raise_error(EY::ApiHMAC::HmacAuthFail)
55
55
  end
56
56
 
57
+ it "unauthorized when lookup fails" do
58
+ lambda{
59
+ EY::ApiHMAC::SSO.authenticate!("http://example.com/sign_test"){|x| false}
60
+ }.should raise_error(EY::ApiHMAC::HmacAuthFail)
61
+ end
62
+
57
63
  it "unauthorized with crappy urls" do
58
64
  lambda{
59
65
  EY::ApiHMAC::SSO.authenticate!("http://example.com/sign_test", &@auth_key_lookup)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ey_api_hmac
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 6
10
- version: 0.4.6
9
+ - 7
10
+ version: 0.4.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Jacob Burkhart & Thorben Schr\xC3\xB6der & David Calavera & others"