auth-hmac 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
- == 1.0.1 2008-08-11
1
+ == 1.0.1 2008-08-22
2
+
3
+ * Fixed nil pointer exception when with_auth called with nil creds.
4
+
5
+ == 1.0.0 2008-08-11
2
6
 
3
7
  * Initial release
data/lib/auth-hmac.rb CHANGED
@@ -207,7 +207,7 @@ class AuthHMAC
207
207
  end
208
208
 
209
209
  def hmac_authenticated?
210
- self.class.authhmac.authenticated?(request)
210
+ self.class.authhmac.nil? ? true : self.class.authhmac.authenticated?(request)
211
211
  end
212
212
  end
213
213
 
@@ -2,7 +2,7 @@ class AuthHMAC
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -228,6 +228,35 @@ describe AuthHMAC do
228
228
  def rescue_action(e) raise(e) end
229
229
  end
230
230
 
231
+ class NilCredentialsController < ActionController::Base
232
+ with_auth_hmac nil
233
+ before_filter :force_auth
234
+
235
+ def index
236
+ render :nothing => true, :status => :ok
237
+ end
238
+
239
+ def public
240
+ render :nothing => true, :status => :ok
241
+ end
242
+
243
+ def rescue_action(e) raise(e) end
244
+
245
+ private
246
+ def force_auth
247
+ hmac_authenticated?
248
+ end
249
+ end
250
+
251
+ it "should not raise an error when credentials are nil" do
252
+ request = ActionController::TestRequest.new
253
+ request.action = 'index'
254
+ request.path = "/index"
255
+ lambda do
256
+ NilCredentialsController.new.process(request, ActionController::TestResponse.new).code.should == "200"
257
+ end.should_not raise_error
258
+ end
259
+
231
260
  it "should allow a request with the proper hmac" do
232
261
  request = ActionController::TestRequest.new
233
262
  request.env['Authorization'] = "AuthHMAC access key 1:6BVEVfAyIDoI3K+WallRMnDxROQ="
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auth-hmac
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Geoghegan
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-11 00:00:00 +09:30
12
+ date: 2008-08-22 00:00:00 +09:30
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency