shield 1.0.0.rc1 → 1.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/shield.rb +1 -1
  2. data/test/nested.rb +40 -0
  3. metadata +17 -16
@@ -14,7 +14,7 @@ module Shield
14
14
  tuple = @app.call(env)
15
15
 
16
16
  if tuple[0] == 401
17
- [302, headers(env["PATH_INFO"]), []]
17
+ [302, headers(env["SCRIPT_NAME"] + env["PATH_INFO"]), []]
18
18
  else
19
19
  tuple
20
20
  end
@@ -0,0 +1,40 @@
1
+ require File.expand_path("helper", File.dirname(__FILE__))
2
+ require File.expand_path("user", File.dirname(__FILE__))
3
+
4
+ Cuba.use Rack::Session::Cookie
5
+ Cuba.plugin Shield::Helpers
6
+
7
+ class Admin < Cuba
8
+ use Shield::Middleware, "/admin/login"
9
+
10
+ define do
11
+ on "login" do
12
+ res.write "Login"
13
+ end
14
+
15
+ on default do
16
+ res.status = 401
17
+ end
18
+ end
19
+ end
20
+
21
+ Cuba.define do
22
+ on "admin" do
23
+ run Admin
24
+ end
25
+ end
26
+
27
+ scope do
28
+ def app
29
+ Cuba
30
+ end
31
+
32
+ setup do
33
+ clear_cookies
34
+ end
35
+
36
+ test "return + return flow" do
37
+ get "/admin"
38
+ assert_equal "/admin/login?return=%2Fadmin", redirection_url
39
+ end
40
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shield
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc1
4
+ version: 1.0.0.rc2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-03-30 00:00:00.000000000 Z
14
+ date: 2012-04-04 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: pbkdf2
18
- requirement: &70325933980460 !ruby/object:Gem::Requirement
18
+ requirement: &70286967916000 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: '0'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70325933980460
26
+ version_requirements: *70286967916000
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: cutest
29
- requirement: &70325933977700 !ruby/object:Gem::Requirement
29
+ requirement: &70286967911980 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
- version_requirements: *70325933977700
37
+ version_requirements: *70286967911980
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: cuba
40
- requirement: &70325933976980 !ruby/object:Gem::Requirement
40
+ requirement: &70286967911020 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: '0'
46
46
  type: :development
47
47
  prerelease: false
48
- version_requirements: *70325933976980
48
+ version_requirements: *70286967911020
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: sinatra
51
- requirement: &70325933976340 !ruby/object:Gem::Requirement
51
+ requirement: &70286967909960 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: '0'
57
57
  type: :development
58
58
  prerelease: false
59
- version_requirements: *70325933976340
59
+ version_requirements: *70286967909960
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: rack-test
62
- requirement: &70325933975460 !ruby/object:Gem::Requirement
62
+ requirement: &70286967909120 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ! '>='
@@ -67,10 +67,10 @@ dependencies:
67
67
  version: '0'
68
68
  type: :development
69
69
  prerelease: false
70
- version_requirements: *70325933975460
70
+ version_requirements: *70286967909120
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: sequel
73
- requirement: &70325933974800 !ruby/object:Gem::Requirement
73
+ requirement: &70286967908300 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
76
  - - ! '>='
@@ -78,10 +78,10 @@ dependencies:
78
78
  version: '0'
79
79
  type: :development
80
80
  prerelease: false
81
- version_requirements: *70325933974800
81
+ version_requirements: *70286967908300
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: ohm
84
- requirement: &70325933973720 !ruby/object:Gem::Requirement
84
+ requirement: &70286959656940 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
87
  - - ~>
@@ -89,7 +89,7 @@ dependencies:
89
89
  version: '0.1'
90
90
  type: :development
91
91
  prerelease: false
92
- version_requirements: *70325933973720
92
+ version_requirements: *70286959656940
93
93
  description: ! "\n Provides all the protocol you need in order to do authentication
94
94
  on\n your rack application. The implementation specifics can be found in\n http://github.com/cyx/shield-contrib\n
95
95
  \ "
@@ -109,6 +109,7 @@ files:
109
109
  - test/helper.rb
110
110
  - test/middleware.rb
111
111
  - test/model.rb
112
+ - test/nested.rb
112
113
  - test/ohm.rb
113
114
  - test/password.rb
114
115
  - test/sequel.rb