rack-wwwhisper 1.1.6 → 1.1.7
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/lib/rack/wwwhisper.rb +3 -2
- data/lib/rack/wwwhisper_version.rb +1 -1
- data/test/test_wwwhisper.rb +20 -1
- metadata +8 -2
data/lib/rack/wwwhisper.rb
CHANGED
@@ -110,12 +110,13 @@ class WWWhisper
|
|
110
110
|
|
111
111
|
if auth_resp.code == '200'
|
112
112
|
debug req, 'access granted'
|
113
|
-
|
113
|
+
user = auth_resp['User']
|
114
|
+
env['REMOTE_USER'] = user if user
|
114
115
|
status, headers, body = dispatch(req)
|
115
116
|
if should_inject_iframe(status, headers)
|
116
117
|
body = inject_iframe(headers, body)
|
117
118
|
end
|
118
|
-
headers['User'] =
|
119
|
+
headers['User'] = user if user
|
119
120
|
[status, headers, body]
|
120
121
|
else
|
121
122
|
debug req, {
|
data/test/test_wwwhisper.rb
CHANGED
@@ -68,6 +68,11 @@ class TestWWWhisper < Test::Unit::TestCase
|
|
68
68
|
{:status => 200, :body => '', :headers => {'User' => TEST_USER}}
|
69
69
|
end
|
70
70
|
|
71
|
+
def open_location_granted()()
|
72
|
+
# Open locations allow not authenticated access, 'User' can be not set
|
73
|
+
{:status => 200, :body => '', :headers => {}}
|
74
|
+
end
|
75
|
+
|
71
76
|
def test_wwwhisper_url_required
|
72
77
|
ENV.delete('WWWHISPER_URL')
|
73
78
|
# Exception should not be raised during initialization, but during
|
@@ -88,7 +93,7 @@ class TestWWWhisper < Test::Unit::TestCase
|
|
88
93
|
get path
|
89
94
|
assert last_response.ok?
|
90
95
|
assert_equal 'Hello World', last_response.body
|
91
|
-
|
96
|
+
assert !last_response.original_headers.has_key?('User')
|
92
97
|
end
|
93
98
|
|
94
99
|
def test_auth_query_path
|
@@ -108,6 +113,20 @@ class TestWWWhisper < Test::Unit::TestCase
|
|
108
113
|
assert_requested :get, full_url(@wwwhisper.auth_query(path))
|
109
114
|
end
|
110
115
|
|
116
|
+
def test_open_location_request_allowed
|
117
|
+
# Configure MockBackend to make sure REMOTE_USER is not set.
|
118
|
+
@wwwhisper = Rack::WWWhisper.new(MockBackend.new(nil))
|
119
|
+
path = '/foo/bar'
|
120
|
+
stub_request(:get, full_url(@wwwhisper.auth_query(path))).
|
121
|
+
to_return(open_location_granted())
|
122
|
+
|
123
|
+
get path
|
124
|
+
assert last_response.ok?
|
125
|
+
assert_equal 'Hello World', last_response.body
|
126
|
+
assert !last_response.original_headers.has_key?('User')
|
127
|
+
assert_requested :get, full_url(@wwwhisper.auth_query(path))
|
128
|
+
end
|
129
|
+
|
111
130
|
def test_login_required
|
112
131
|
path = '/foo/bar'
|
113
132
|
stub_request(:get, full_url(@wwwhisper.auth_query(path))).
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-wwwhisper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -130,12 +130,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
130
130
|
- - ! '>='
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
|
+
segments:
|
134
|
+
- 0
|
135
|
+
hash: 3214471811457318214
|
133
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
137
|
none: false
|
135
138
|
requirements:
|
136
139
|
- - ! '>='
|
137
140
|
- !ruby/object:Gem::Version
|
138
141
|
version: '0'
|
142
|
+
segments:
|
143
|
+
- 0
|
144
|
+
hash: 3214471811457318214
|
139
145
|
requirements: []
|
140
146
|
rubyforge_project:
|
141
147
|
rubygems_version: 1.8.24
|