rack-oauth2 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +9 -7
- data/VERSION +1 -1
- data/lib/rack/oauth2/client.rb +1 -0
- data/lib/rack/oauth2/debugger.rb +3 -1
- data/spec/rack/oauth2/client_spec.rb +5 -0
- data/spec/rack/oauth2/debugger/request_filter_spec.rb +29 -0
- data/spec/rack/oauth2/oauth2_spec.rb +31 -0
- metadata +6 -2
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rack-oauth2 (0.9.
|
4
|
+
rack-oauth2 (0.9.4)
|
5
5
|
activesupport (>= 2.3)
|
6
6
|
attr_required (>= 0.0.3)
|
7
7
|
httpclient (>= 2.2.0.2)
|
@@ -12,18 +12,20 @@ PATH
|
|
12
12
|
GEM
|
13
13
|
remote: http://rubygems.org/
|
14
14
|
specs:
|
15
|
-
activesupport (3.0
|
15
|
+
activesupport (3.1.0)
|
16
|
+
multi_json (~> 1.0)
|
16
17
|
addressable (2.2.6)
|
17
18
|
attr_required (0.0.3)
|
18
19
|
bouncy-castle-java (1.5.0146.1)
|
19
20
|
crack (0.1.8)
|
20
|
-
diff-lcs (1.1.
|
21
|
+
diff-lcs (1.1.3)
|
21
22
|
httpclient (2.2.1)
|
22
23
|
i18n (0.6.0)
|
23
24
|
jruby-openssl (0.7.4)
|
24
25
|
bouncy-castle-java
|
25
|
-
json (1.5.
|
26
|
-
json (1.5.
|
26
|
+
json (1.5.4)
|
27
|
+
json (1.5.4-java)
|
28
|
+
multi_json (1.0.3)
|
27
29
|
rack (1.3.2)
|
28
30
|
rake (0.9.2)
|
29
31
|
rcov (0.9.10)
|
@@ -36,8 +38,8 @@ GEM
|
|
36
38
|
rspec-expectations (2.6.0)
|
37
39
|
diff-lcs (~> 1.1.2)
|
38
40
|
rspec-mocks (2.6.0)
|
39
|
-
webmock (1.7.
|
40
|
-
addressable (
|
41
|
+
webmock (1.7.6)
|
42
|
+
addressable (~> 2.2, > 2.2.5)
|
41
43
|
crack (>= 0.1.7)
|
42
44
|
|
43
45
|
PLATFORMS
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.5
|
data/lib/rack/oauth2/client.rb
CHANGED
@@ -17,6 +17,7 @@ module Rack
|
|
17
17
|
|
18
18
|
def authorization_uri(params = {})
|
19
19
|
params[:response_type] ||= :code
|
20
|
+
params[:response_type] = Array(params[:response_type]).join(' ')
|
20
21
|
params[:scope] = Array(params[:scope]).join(' ')
|
21
22
|
Util.redirect_uri absolute_uri_for(authorization_endpoint), :query, params.merge(
|
22
23
|
:client_id => self.identifier,
|
data/lib/rack/oauth2/debugger.rb
CHANGED
@@ -47,6 +47,11 @@ describe Rack::OAuth2::Client do
|
|
47
47
|
it { should include 'response_type=token' }
|
48
48
|
end
|
49
49
|
|
50
|
+
context 'when response_type is an Array' do
|
51
|
+
subject { client.authorization_uri(:response_type => [:token, :code]) }
|
52
|
+
it { should include 'response_type=token+code' }
|
53
|
+
end
|
54
|
+
|
50
55
|
context 'when scope is given' do
|
51
56
|
subject { client.authorization_uri(:scope => [:scope1, :scope2]) }
|
52
57
|
it { should include 'scope=scope1+scope2' }
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Rack::OAuth2::Debugger::RequestFilter do
|
4
|
+
let(:resource_endpoint) { 'https://example.com/resources' }
|
5
|
+
let(:request) { HTTP::Message.new_request(:get, URI.parse(resource_endpoint)) }
|
6
|
+
let(:response) { HTTP::Message.new_response({:hello => 'world'}.to_json) }
|
7
|
+
let(:request_filter) { Rack::OAuth2::Debugger::RequestFilter.new }
|
8
|
+
|
9
|
+
describe '#filter_request' do
|
10
|
+
it 'should log request' do
|
11
|
+
Rack::OAuth2.logger.should_receive(:info).with(
|
12
|
+
"======= [Rack::OAuth2] HTTP REQUEST STARTED =======\n" +
|
13
|
+
request.dump
|
14
|
+
)
|
15
|
+
request_filter.filter_request(request)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#filter_response' do
|
20
|
+
it 'should log response' do
|
21
|
+
Rack::OAuth2.logger.should_receive(:info).with(
|
22
|
+
"--------------------------------------------------\n" +
|
23
|
+
response.dump +
|
24
|
+
"\n======= [Rack::OAuth2] HTTP REQUEST FINISHED ======="
|
25
|
+
)
|
26
|
+
request_filter.filter_response(request, response)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Rack::OAuth2 do
|
4
|
+
subject { Rack::OAuth2 }
|
5
|
+
after { Rack::OAuth2.debugging = false }
|
6
|
+
|
7
|
+
its(:logger) { should be_a Logger }
|
8
|
+
its(:debugging?) { should be_false }
|
9
|
+
|
10
|
+
describe '.debug!' do
|
11
|
+
before { Rack::OAuth2.debug! }
|
12
|
+
its(:debugging?) { should be_true }
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '.debug' do
|
16
|
+
it 'should enable debugging within given block' do
|
17
|
+
Rack::OAuth2.debug do
|
18
|
+
Rack::OAuth2.debugging?.should be_true
|
19
|
+
end
|
20
|
+
Rack::OAuth2.debugging?.should be_false
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should not force disable debugging' do
|
24
|
+
Rack::OAuth2.debug!
|
25
|
+
Rack::OAuth2.debug do
|
26
|
+
Rack::OAuth2.debugging?.should be_true
|
27
|
+
end
|
28
|
+
Rack::OAuth2.debugging?.should be_true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rack-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.9.
|
5
|
+
version: 0.9.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- nov matake
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-09-
|
13
|
+
date: 2011-09-11 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -211,6 +211,8 @@ files:
|
|
211
211
|
- spec/rack/oauth2/client/grant/password_spec.rb
|
212
212
|
- spec/rack/oauth2/client/grant/refresh_token_spec.rb
|
213
213
|
- spec/rack/oauth2/client_spec.rb
|
214
|
+
- spec/rack/oauth2/debugger/request_filter_spec.rb
|
215
|
+
- spec/rack/oauth2/oauth2_spec.rb
|
214
216
|
- spec/rack/oauth2/server/abstract/error_spec.rb
|
215
217
|
- spec/rack/oauth2/server/authorize/code_spec.rb
|
216
218
|
- spec/rack/oauth2/server/authorize/error_spec.rb
|
@@ -284,6 +286,8 @@ test_files:
|
|
284
286
|
- spec/rack/oauth2/client/grant/password_spec.rb
|
285
287
|
- spec/rack/oauth2/client/grant/refresh_token_spec.rb
|
286
288
|
- spec/rack/oauth2/client_spec.rb
|
289
|
+
- spec/rack/oauth2/debugger/request_filter_spec.rb
|
290
|
+
- spec/rack/oauth2/oauth2_spec.rb
|
287
291
|
- spec/rack/oauth2/server/abstract/error_spec.rb
|
288
292
|
- spec/rack/oauth2/server/authorize/code_spec.rb
|
289
293
|
- spec/rack/oauth2/server/authorize/error_spec.rb
|