rack-oauth2 1.10.1 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e09ccf53817af77d1e714e25e20e9b76fd63de080fb1f3d9617fff3aef126a32
4
- data.tar.gz: '088a7815b796f5c05ac3445ee39cc997bcc20964a66c1d4fc7a5c3906e27eb36'
3
+ metadata.gz: 15c2f24e86e767637d2796e7b66391355736973f1ee698d6431833e854f1b938
4
+ data.tar.gz: eb49532f9f13f99a485c9298807fdda909a68f2bc57e15666d6618b304efa5c8
5
5
  SHA512:
6
- metadata.gz: b261cc8b398a4b02797b581d455307bc46f0f248990c4fef7b0286eb7eb2e191568ecb5c8c0b6123ef5cd43f5f517c0980bf405b9b3efd0874c29b8e97218696
7
- data.tar.gz: adf42215042112d7577d76b35437fa2b2b45f8a259a896c5621790a7603053e6ea1ada28ba2d27330e5338689061002cc870969a8895ba040349faea5ec7340b
6
+ metadata.gz: 436dc9861ffb108fbbbf305a5b539fe8d94096eceed2361a3061993ab0d3fd734e7219446e00639e596b28c86f0609cd801285bf62a3e686604876f1538d7275
7
+ data.tar.gz: 365e8aca4188e2ed5c9a973bb2f91050a76d6843de0dfd73e9c4304d7dbdb675f380084fc618663f4b69b4b33f8baa94d4ac5021f63e789fdd630c4c9a2589d2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.10.1
1
+ 1.11.0
@@ -5,7 +5,7 @@ module Rack
5
5
  module ResponseExt
6
6
  def redirect?
7
7
  ensure_finish do
8
- @response.redirect?
8
+ super
9
9
  end
10
10
  end
11
11
 
@@ -17,7 +17,7 @@ module Rack
17
17
 
18
18
  def json
19
19
  ensure_finish do
20
- @response.body
20
+ @body
21
21
  end
22
22
  end
23
23
 
@@ -39,7 +39,7 @@ module Rack
39
39
  end
40
40
 
41
41
  def ensure_finish
42
- @status, @header, @response = finish unless finished?
42
+ @status, @header, @body = finish unless finished?
43
43
  yield
44
44
  end
45
45
  end
@@ -35,11 +35,12 @@ module Rack
35
35
 
36
36
  def redirect_uri(base_uri, location, params)
37
37
  redirect_uri = parse_uri base_uri
38
+ encoded_response_params = Util.compact_hash(params).to_query.gsub('+', '%20')
38
39
  case location
39
40
  when :query
40
- redirect_uri.query = [redirect_uri.query, Util.compact_hash(params).to_query].compact.join('&')
41
+ redirect_uri.query = [redirect_uri.query, encoded_response_params].compact.join('&')
41
42
  when :fragment
42
- redirect_uri.fragment = Util.compact_hash(params).to_query
43
+ redirect_uri.fragment = encoded_response_params
43
44
  end
44
45
  redirect_uri.to_s
45
46
  end
@@ -59,4 +60,4 @@ module Rack
59
60
  end
60
61
  end
61
62
  end
62
- end
63
+ end
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
14
14
  s.files = `git ls-files`.split("\n")
15
15
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
- s.add_runtime_dependency 'rack'
16
+ s.add_runtime_dependency 'rack', '>= 2.1.0'
17
17
  s.add_runtime_dependency 'httpclient'
18
18
  s.add_runtime_dependency 'activesupport'
19
19
  s.add_runtime_dependency 'attr_required'
@@ -49,12 +49,12 @@ describe Rack::OAuth2::Client do
49
49
 
50
50
  context 'when response_type is an Array' do
51
51
  subject { client.authorization_uri(response_type: [:token, :code]) }
52
- it { should include 'response_type=token+code' }
52
+ it { should include 'response_type=token%20code' }
53
53
  end
54
54
 
55
55
  context 'when scope is given' do
56
56
  subject { client.authorization_uri(scope: [:scope1, :scope2]) }
57
- it { should include 'scope=scope1+scope2' }
57
+ it { should include 'scope=scope1%20scope2' }
58
58
  end
59
59
  end
60
60
 
@@ -51,7 +51,7 @@ describe Rack::OAuth2::Server::Authorize::Code do
51
51
  error: :access_denied,
52
52
  error_description: Rack::OAuth2::Server::Authorize::ErrorMethods::DEFAULT_DESCRIPTION[:access_denied]
53
53
  }
54
- response.location.should == "#{redirect_uri}?#{error_message.to_query}&state=state"
54
+ response.location.should == "#{redirect_uri}?#{error_message.to_query.gsub('+', '%20')}&state=state"
55
55
  end
56
56
  end
57
57
  end
@@ -54,7 +54,7 @@ describe Rack::OAuth2::Server::Authorize::Extension::CodeAndToken do
54
54
  error: :access_denied,
55
55
  error_description: Rack::OAuth2::Server::Authorize::ErrorMethods::DEFAULT_DESCRIPTION[:access_denied]
56
56
  }
57
- response.location.should == "#{redirect_uri}##{error_message.to_query}"
57
+ response.location.should == "#{redirect_uri}##{error_message.to_query.gsub('+', '%20')}"
58
58
  end
59
59
  end
60
60
  end
@@ -67,7 +67,7 @@ describe Rack::OAuth2::Server::Authorize::Token do
67
67
  error: :access_denied,
68
68
  error_description: Rack::OAuth2::Server::Authorize::ErrorMethods::DEFAULT_DESCRIPTION[:access_denied]
69
69
  }
70
- response.location.should == "#{redirect_uri}##{error_message.to_query}&state=state"
70
+ response.location.should == "#{redirect_uri}##{error_message.to_query.gsub('+', '%20')}&state=state"
71
71
  end
72
72
  end
73
73
  end
@@ -10,7 +10,7 @@ describe Rack::OAuth2::Server::Resource::BadRequest do
10
10
  status, header, response = error.finish
11
11
  status.should == 400
12
12
  header['Content-Type'].should == 'application/json'
13
- response.body.should == ['{"error":"invalid_request"}']
13
+ response.should == ['{"error":"invalid_request"}']
14
14
  end
15
15
  end
16
16
  end
@@ -44,7 +44,7 @@ describe Rack::OAuth2::Server::Resource::Unauthorized do
44
44
  status.should == 401
45
45
  header['Content-Type'].should == 'application/json'
46
46
  header['WWW-Authenticate'].should == "Scheme realm=\"#{realm}\", error=\"invalid_token\""
47
- response.body.should == ['{"error":"invalid_token"}']
47
+ response.should == ['{"error":"invalid_token"}']
48
48
  end
49
49
 
50
50
  context 'when error_code is not invalid_token' do
@@ -53,7 +53,7 @@ describe Rack::OAuth2::Server::Resource::Unauthorized do
53
53
  it 'should have error_code in body but not in WWW-Authenticate header' do
54
54
  status, header, response = error_with_scheme.finish
55
55
  header['WWW-Authenticate'].should == "Scheme realm=\"#{realm}\""
56
- response.body.first.should include '"error":"something"'
56
+ response.first.should include '"error":"something"'
57
57
  end
58
58
  end
59
59
 
@@ -63,7 +63,7 @@ describe Rack::OAuth2::Server::Resource::Unauthorized do
63
63
  it 'should have error_code in body but not in WWW-Authenticate header' do
64
64
  status, header, response = error_with_scheme.finish
65
65
  header['WWW-Authenticate'].should == "Scheme realm=\"#{realm}\""
66
- response.body.first.should == '{"error":"unauthorized"}'
66
+ response.first.should == '{"error":"unauthorized"}'
67
67
  end
68
68
  end
69
69
 
@@ -74,7 +74,7 @@ describe Rack::OAuth2::Server::Resource::Unauthorized do
74
74
  it 'should use given realm' do
75
75
  status, header, response = error_with_scheme.finish
76
76
  header['WWW-Authenticate'].should == "Scheme realm=\"#{realm}\""
77
- response.body.first.should include '"error":"something"'
77
+ response.first.should include '"error":"something"'
78
78
  end
79
79
  end
80
80
  end
@@ -91,7 +91,7 @@ describe Rack::OAuth2::Server::Resource::Forbidden do
91
91
  status, header, response = error.finish
92
92
  status.should == 403
93
93
  header['Content-Type'].should == 'application/json'
94
- response.body.should == ['{"error":"insufficient_scope"}']
94
+ response.should == ['{"error":"insufficient_scope"}']
95
95
  end
96
96
  end
97
97
 
@@ -100,7 +100,7 @@ describe Rack::OAuth2::Server::Resource::Forbidden do
100
100
 
101
101
  it 'should have blank WWW-Authenticate header' do
102
102
  status, header, response = error.finish
103
- response.body.first.should include '"scope":"scope1 scope2"'
103
+ response.first.should include '"scope":"scope1 scope2"'
104
104
  end
105
105
  end
106
106
  end
@@ -10,7 +10,7 @@ describe Rack::OAuth2::Server::Token::BadRequest do
10
10
  status, header, response = error.finish
11
11
  status.should == 400
12
12
  header['Content-Type'].should == 'application/json'
13
- response.body.should == ['{"error":"invalid_request"}']
13
+ response.should == ['{"error":"invalid_request"}']
14
14
  end
15
15
  end
16
16
  end
@@ -26,7 +26,7 @@ describe Rack::OAuth2::Server::Token::Unauthorized do
26
26
  status.should == 401
27
27
  header['Content-Type'].should == 'application/json'
28
28
  header['WWW-Authenticate'].should == 'Basic realm="OAuth2 Token Endpoint"'
29
- response.body.should == ['{"error":"invalid_request"}']
29
+ response.should == ['{"error":"invalid_request"}']
30
30
  end
31
31
  end
32
32
  end
@@ -74,4 +74,4 @@ describe Rack::OAuth2::Server::Token::ErrorMethods do
74
74
  end
75
75
  end
76
76
  end
77
- end
77
+ end
@@ -30,7 +30,7 @@ describe Rack::OAuth2::Server::Token do
30
30
  it 'should fail with unsupported_grant_type' do
31
31
  status, header, response = app.call(env)
32
32
  status.should == 400
33
- response.body.first.should include '"error":"invalid_request"'
33
+ response.first.should include '"error":"invalid_request"'
34
34
  end
35
35
  end
36
36
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.1
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nov matake
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-15 00:00:00.000000000 Z
11
+ date: 2020-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 2.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 2.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: httpclient
29
29
  requirement: !ruby/object:Gem::Requirement