rails_warden 0.5.7 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/rails_warden.rb +3 -1
- metadata +12 -28
- data/CHANGELOG +0 -6
- data/Gemfile +0 -10
- data/Gemfile.lock +0 -91
- data/Rakefile +0 -10
- data/VERSION +0 -1
- data/rails_warden.gemspec +0 -26
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/spec/controller_mixin_spec.rb +0 -79
- data/spec/rails_warden_spec.rb +0 -67
- data/spec/spec_helper.rb +0 -5
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a7727506f01c1addc52ebd0a485dca159d0967a6
|
4
|
+
data.tar.gz: e857c3e217778e0dd441a577591c3f7db466a82f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 82279c073deb6a51b74b4a9e8bdff7d4a2e95c50186ac046e187df1e05284e5f0d68f3ee515a71d23b34e6fc01a6137ea66a8ecf3632614a111830f9795aad66
|
7
|
+
data.tar.gz: 946abce52c2e07140547a781fc5360adc3ec11d067e686cea508fc74b1a7cbb6c66f1225e5f05e0566e7b6461ea9ad5cb873cc47b415ac8ae3ea5c30df9e0273
|
data/lib/rails_warden.rb
CHANGED
@@ -23,7 +23,9 @@ module Warden::Mixins::Common
|
|
23
23
|
|
24
24
|
def response
|
25
25
|
return @response if @response
|
26
|
-
|
26
|
+
if defined?(ActionDispatch::Response)
|
27
|
+
@response = ActionDispatch::Response.new
|
28
|
+
elsif env['action_controller.rescue.response']
|
27
29
|
@response = env['action_controller.rescue.response']
|
28
30
|
else
|
29
31
|
Rack::Response.new(env)
|
metadata
CHANGED
@@ -1,30 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_warden
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.8
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Daniel Neighman
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-02-25 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: warden
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 1.0.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 1.0.0
|
30
27
|
description: A gem that provides authenitcation via the Warden framework
|
@@ -36,47 +33,34 @@ extra_rdoc_files:
|
|
36
33
|
- README.textile
|
37
34
|
- TODO
|
38
35
|
files:
|
39
|
-
- CHANGELOG
|
40
|
-
- Gemfile
|
41
|
-
- Gemfile.lock
|
42
36
|
- lib/rails_warden/controller_mixin.rb
|
43
37
|
- lib/rails_warden/manager.rb
|
44
38
|
- lib/rails_warden/rails_settings.rb
|
45
39
|
- lib/rails_warden.rb
|
46
40
|
- LICENSE
|
47
|
-
- rails_warden.gemspec
|
48
|
-
- Rakefile
|
49
41
|
- README.textile
|
50
|
-
- script/destroy
|
51
|
-
- script/generate
|
52
|
-
- spec/controller_mixin_spec.rb
|
53
|
-
- spec/rails_warden_spec.rb
|
54
|
-
- spec/spec_helper.rb
|
55
42
|
- TODO
|
56
|
-
|
57
|
-
homepage: http://github.com/hassox/rails_warden
|
43
|
+
homepage: https://github.com/hassox/rails_warden
|
58
44
|
licenses: []
|
45
|
+
metadata: {}
|
59
46
|
post_install_message:
|
60
|
-
rdoc_options:
|
61
|
-
- --charset=UTF-8
|
47
|
+
rdoc_options: []
|
62
48
|
require_paths:
|
63
49
|
- lib
|
64
50
|
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
51
|
requirements:
|
67
|
-
- -
|
52
|
+
- - '>='
|
68
53
|
- !ruby/object:Gem::Version
|
69
54
|
version: '0'
|
70
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
56
|
requirements:
|
73
|
-
- -
|
57
|
+
- - '>='
|
74
58
|
- !ruby/object:Gem::Version
|
75
59
|
version: '0'
|
76
60
|
requirements: []
|
77
|
-
rubyforge_project:
|
78
|
-
rubygems_version:
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 2.0.14
|
79
63
|
signing_key:
|
80
|
-
specification_version:
|
64
|
+
specification_version: 4
|
81
65
|
summary: A gem that provides authenitcation via the Warden framework
|
82
66
|
test_files: []
|
data/CHANGELOG
DELETED
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
rails_warden (0.5.7)
|
5
|
-
warden (>= 1.0.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: http://rubygems.org/
|
9
|
-
specs:
|
10
|
-
abstract (1.0.0)
|
11
|
-
actionmailer (3.0.7)
|
12
|
-
actionpack (= 3.0.7)
|
13
|
-
mail (~> 2.2.15)
|
14
|
-
actionpack (3.0.7)
|
15
|
-
activemodel (= 3.0.7)
|
16
|
-
activesupport (= 3.0.7)
|
17
|
-
builder (~> 2.1.2)
|
18
|
-
erubis (~> 2.6.6)
|
19
|
-
i18n (~> 0.5.0)
|
20
|
-
rack (~> 1.2.1)
|
21
|
-
rack-mount (~> 0.6.14)
|
22
|
-
rack-test (~> 0.5.7)
|
23
|
-
tzinfo (~> 0.3.23)
|
24
|
-
activemodel (3.0.7)
|
25
|
-
activesupport (= 3.0.7)
|
26
|
-
builder (~> 2.1.2)
|
27
|
-
i18n (~> 0.5.0)
|
28
|
-
activerecord (3.0.7)
|
29
|
-
activemodel (= 3.0.7)
|
30
|
-
activesupport (= 3.0.7)
|
31
|
-
arel (~> 2.0.2)
|
32
|
-
tzinfo (~> 0.3.23)
|
33
|
-
activeresource (3.0.7)
|
34
|
-
activemodel (= 3.0.7)
|
35
|
-
activesupport (= 3.0.7)
|
36
|
-
activesupport (3.0.7)
|
37
|
-
arel (2.0.9)
|
38
|
-
builder (2.1.2)
|
39
|
-
diff-lcs (1.1.2)
|
40
|
-
erubis (2.6.6)
|
41
|
-
abstract (>= 1.0.0)
|
42
|
-
i18n (0.5.0)
|
43
|
-
mail (2.2.17)
|
44
|
-
activesupport (>= 2.3.6)
|
45
|
-
i18n (>= 0.4.0)
|
46
|
-
mime-types (~> 1.16)
|
47
|
-
treetop (~> 1.4.8)
|
48
|
-
mime-types (1.16)
|
49
|
-
polyglot (0.3.1)
|
50
|
-
rack (1.2.2)
|
51
|
-
rack-mount (0.6.14)
|
52
|
-
rack (>= 1.0.0)
|
53
|
-
rack-test (0.5.7)
|
54
|
-
rack (>= 1.0)
|
55
|
-
rails (3.0.7)
|
56
|
-
actionmailer (= 3.0.7)
|
57
|
-
actionpack (= 3.0.7)
|
58
|
-
activerecord (= 3.0.7)
|
59
|
-
activeresource (= 3.0.7)
|
60
|
-
activesupport (= 3.0.7)
|
61
|
-
bundler (~> 1.0)
|
62
|
-
railties (= 3.0.7)
|
63
|
-
railties (3.0.7)
|
64
|
-
actionpack (= 3.0.7)
|
65
|
-
activesupport (= 3.0.7)
|
66
|
-
rake (>= 0.8.7)
|
67
|
-
thor (~> 0.14.4)
|
68
|
-
rake (0.8.7)
|
69
|
-
rspec (2.5.0)
|
70
|
-
rspec-core (~> 2.5.0)
|
71
|
-
rspec-expectations (~> 2.5.0)
|
72
|
-
rspec-mocks (~> 2.5.0)
|
73
|
-
rspec-core (2.5.1)
|
74
|
-
rspec-expectations (2.5.0)
|
75
|
-
diff-lcs (~> 1.1.2)
|
76
|
-
rspec-mocks (2.5.0)
|
77
|
-
thor (0.14.6)
|
78
|
-
treetop (1.4.9)
|
79
|
-
polyglot (>= 0.3.1)
|
80
|
-
tzinfo (0.3.26)
|
81
|
-
warden (1.2.0)
|
82
|
-
rack (>= 1.0)
|
83
|
-
|
84
|
-
PLATFORMS
|
85
|
-
ruby
|
86
|
-
|
87
|
-
DEPENDENCIES
|
88
|
-
rails (>= 3)
|
89
|
-
rails_warden!
|
90
|
-
rake
|
91
|
-
rspec (>= 2.0)
|
data/Rakefile
DELETED
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.5.3
|
data/rails_warden.gemspec
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
Gem::Specification.new do |s|
|
2
|
-
s.name = %q{rails_warden}
|
3
|
-
s.version = "0.5.7"
|
4
|
-
s.authors = ["Daniel Neighman"]
|
5
|
-
s.date = %q{2012-06-05}
|
6
|
-
s.summary = %q{A gem that provides authenitcation via the Warden framework}
|
7
|
-
s.description = %q{A gem that provides authenitcation via the Warden framework}
|
8
|
-
s.email = %q{has.sox@gmail.com}
|
9
|
-
s.homepage = %q{http://github.com/hassox/rails_warden}
|
10
|
-
s.rubygems_version = %q{1.3.7}
|
11
|
-
|
12
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
13
|
-
s.extra_rdoc_files = [
|
14
|
-
"LICENSE",
|
15
|
-
"README.textile",
|
16
|
-
"TODO"
|
17
|
-
]
|
18
|
-
|
19
|
-
s.files = Dir["**/*"]
|
20
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
21
|
-
s.require_paths = ["lib"]
|
22
|
-
s.rubyforge_project = %q{warden}
|
23
|
-
|
24
|
-
s.add_dependency "warden", ">=1.0.0"
|
25
|
-
end
|
26
|
-
|
data/script/destroy
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/destroy'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:newgem_simple, :test_unit]
|
14
|
-
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/generate'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:newgem_simple, :test_unit]
|
14
|
-
RubiGen::Scripts::Generate.new.run(ARGV)
|
@@ -1,79 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
-
require 'ostruct'
|
3
|
-
|
4
|
-
|
5
|
-
describe "rails_warden controller mixin" do
|
6
|
-
|
7
|
-
before(:each) do
|
8
|
-
@app = lambda{|e| [200, {"Content-Type" => "text/plain"}, ["resonse"]]}
|
9
|
-
class FooFailure
|
10
|
-
end
|
11
|
-
|
12
|
-
class User
|
13
|
-
end
|
14
|
-
|
15
|
-
class MockController
|
16
|
-
include RailsWarden::Mixins::HelperMethods
|
17
|
-
include RailsWarden::Mixins::ControllerOnlyMethods
|
18
|
-
attr_accessor :env
|
19
|
-
def request
|
20
|
-
self
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
RailsWarden.default_user_class = nil
|
25
|
-
RailsWarden.unauthenticated_action = nil
|
26
|
-
|
27
|
-
@controller = MockController.new
|
28
|
-
@mock_warden = OpenStruct.new
|
29
|
-
@controller.env = {"warden" => @mock_warden }
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should setup the spec" do
|
33
|
-
@controller.warden.should_not be_nil
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should provide access to the warden instance" do
|
37
|
-
@controller.warden.should == @controller.env["warden"]
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should run authenticate on warden" do
|
41
|
-
@mock_warden.should_receive(:authenticate).and_return(true)
|
42
|
-
@controller.authenticate
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should run authenticate! on warden" do
|
46
|
-
@mock_warden.should_receive(:authenticate!).and_return(true)
|
47
|
-
@controller.authenticate!
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should run authenticate? on warden" do
|
51
|
-
@mock_warden.should_receive(:authenticated?).and_return(true)
|
52
|
-
@controller.authenticated?
|
53
|
-
end
|
54
|
-
|
55
|
-
it "should proxy logged_in? to authenticated" do
|
56
|
-
@mock_warden.should_receive(:authenticated?).and_return(true)
|
57
|
-
@controller.logged_in?
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should run user on warden" do
|
61
|
-
@mock_warden.should_receive(:user).and_return(true)
|
62
|
-
@controller.user
|
63
|
-
end
|
64
|
-
|
65
|
-
it "should run current_user on warden" do
|
66
|
-
@mock_warden.should_receive(:user).and_return(true)
|
67
|
-
@controller.current_user
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should set the user on warden" do
|
71
|
-
@mock_warden.should_receive(:set_user).and_return(true)
|
72
|
-
@controller.user = User.new
|
73
|
-
end
|
74
|
-
|
75
|
-
it "should proxy logout to warden" do
|
76
|
-
@mock_warden.should_receive(:logout).and_return(true)
|
77
|
-
@controller.logout
|
78
|
-
end
|
79
|
-
end
|
data/spec/rails_warden_spec.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
-
|
3
|
-
describe "rails_warden" do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
@app = lambda{|e| Rack::Resposnse.new("response").finish}
|
7
|
-
class ::FooFailure
|
8
|
-
end
|
9
|
-
|
10
|
-
class ::FooUser
|
11
|
-
end
|
12
|
-
|
13
|
-
class ::User
|
14
|
-
end
|
15
|
-
|
16
|
-
RailsWarden.default_user_class = nil
|
17
|
-
RailsWarden.unauthenticated_action = nil
|
18
|
-
end
|
19
|
-
|
20
|
-
it "RailsWarden::Manager.new should return an instance of Warden::Manager" do
|
21
|
-
r = RailsWarden::Manager.new(@app, :failure_app => "foo_failure", :defaults => :password)
|
22
|
-
r.should be_an_instance_of(Warden::Manager)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should set the failure application to FooFailure" do
|
26
|
-
r = RailsWarden::Manager.new(@app, :failure_app => "foo_failure", :defaults => :password)
|
27
|
-
r.config.failure_app.should == FooFailure
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should set the default user to FooUser if specified" do
|
31
|
-
r = RailsWarden::Manager.new(@app, :failure_app => "foo_failure",
|
32
|
-
:defaults => :password,
|
33
|
-
:default_user => "foo_user")
|
34
|
-
RailsWarden.default_user_class.should == FooUser
|
35
|
-
end
|
36
|
-
|
37
|
-
it "should set the default user to User if there is none specified" do
|
38
|
-
r = RailsWarden::Manager.new(@app, :failure_app => "foo_failure",
|
39
|
-
:defaults => :password)
|
40
|
-
RailsWarden.default_user_class.should == User
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should set the failure action when specified" do
|
44
|
-
r = RailsWarden::Manager.new(@app, :failure_app => "foo_failure",
|
45
|
-
:defaults => :password,
|
46
|
-
:unauthenticated_action => :bad_login
|
47
|
-
)
|
48
|
-
RailsWarden.unauthenticated_action.should == "bad_login"
|
49
|
-
end
|
50
|
-
|
51
|
-
it "should set the failure action to unauthenticated when not specified" do
|
52
|
-
r = RailsWarden::Manager.new(@app, :failure_app => "foo_failure",
|
53
|
-
:defaults => :password
|
54
|
-
)
|
55
|
-
RailsWarden.unauthenticated_action.should == "unauthenticated"
|
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
|
-
|
67
|
-
end
|