rails_warden 0.2.4 → 0.2.5

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
@@ -21,7 +21,7 @@ module Warden::Mixins::Common
21
21
  def raw_session
22
22
  request.session
23
23
  end
24
-
24
+
25
25
  def reset_session!
26
26
  raw_session.inspect # why do I have to inspect it to get it to clear?
27
27
  raw_session.clear
@@ -32,6 +32,14 @@ Warden::Manager.before_failure do |env, opts|
32
32
  env['warden'].request.params['action'] = RailsWarden.unauthenticated_action || "unauthenticated"
33
33
  end
34
34
 
35
+ # Rails needs the action to be passed in with the params
36
+ Warden::Manager.before_failure do |env, opts|
37
+ if request = env["action_controller.rescue.request"]
38
+ request.params["action"] = RailsWarden.unauthenticated_action
39
+ end
40
+ end
41
+
42
+
35
43
  if defined?(Rails)
36
44
  Rails.configuration.after_initialize do
37
45
  class ActionController::Base
@@ -1,31 +1,24 @@
1
1
  # encoding: utf-8
2
2
  module RailsWarden
3
3
  class Manager
4
-
4
+
5
5
  def self.new(app, opts = {}, &block)
6
6
  # Get the failure application
7
7
  opts[:failure_app] = opts[:failure_app].to_s.classify.constantize if opts[:failure_app]
8
8
  opts[:default_strategies] = [opts[:defaults]].flatten if opts[:defaults]
9
-
9
+
10
10
  # Set the default user
11
11
  if user = opts.delete(:default_user)
12
12
  RailsWarden.default_user_class = user.to_s.classify.constantize
13
13
  end
14
-
14
+
15
15
  # Set the unauthenticated action if it's set
16
16
  if ua = opts.delete(:unauthenticated_action)
17
17
  RailsWarden.unauthenticated_action = ua
18
18
  end
19
-
20
- # Rails needs the action to be passed in with the params
21
- Warden::Manager.before_failure do |env, opts|
22
- if request = env["action_controller.rescue.request"]
23
- request.params["action"] = RailsWarden.unauthenticated_action
24
- end
25
- end
26
-
19
+
27
20
  Warden::Manager.new(app, opts, &block)
28
21
  end
29
-
22
+
30
23
  end
31
- end
24
+ end
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rails_warden}
8
- s.version = "0.2.4"
8
+ s.version = "0.2.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Daniel Neighman"]
12
- s.date = %q{2009-09-09}
12
+ s.date = %q{2009-11-17}
13
13
  s.description = %q{A gem that provides authenitcation via the Warden framework}
14
14
  s.email = %q{has.sox@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -57,3 +57,4 @@ Gem::Specification.new do |s|
57
57
  else
58
58
  end
59
59
  end
60
+
@@ -54,4 +54,14 @@ describe "rails_warden" do
54
54
  )
55
55
  RailsWarden.unauthenticated_action.should == "unauthenticated"
56
56
  end
57
+
58
+ it "should not add a before_failure callback each time it is created" do
59
+ original_number_of_callbacks = Warden::Manager._before_failure.size
60
+
61
+ RailsWarden::Manager.new(@app, :failure_app => "foo_failure",
62
+ :defaults => :password)
63
+
64
+ Warden::Manager._before_failure.size.should == original_number_of_callbacks
65
+ end
66
+
57
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_warden
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Neighman
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-09 00:00:00 +10:00
12
+ date: 2009-11-17 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  requirements: []
65
65
 
66
66
  rubyforge_project: warden
67
- rubygems_version: 1.3.4
67
+ rubygems_version: 1.3.5
68
68
  signing_key:
69
69
  specification_version: 3
70
70
  summary: A gem that provides authenitcation via the Warden framework