rack-oauth2 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -1
- data/VERSION +1 -1
- data/lib/rack/oauth2/client.rb +1 -1
- data/spec/mock_response/tokens/_Bearer.json +6 -0
- data/spec/rack/oauth2/client_spec.rb +13 -0
- metadata +4 -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.1)
|
5
5
|
activesupport (>= 2.3)
|
6
6
|
attr_required (>= 0.0.3)
|
7
7
|
httpclient (>= 2.2.0.2)
|
@@ -23,6 +23,7 @@ GEM
|
|
23
23
|
jruby-openssl (0.7.4)
|
24
24
|
bouncy-castle-java
|
25
25
|
json (1.5.3)
|
26
|
+
json (1.5.3-java)
|
26
27
|
rack (1.3.2)
|
27
28
|
rake (0.9.2)
|
28
29
|
rcov (0.9.10)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.1
|
data/lib/rack/oauth2/client.rb
CHANGED
@@ -79,7 +79,7 @@ module Rack
|
|
79
79
|
|
80
80
|
def handle_success_response(response)
|
81
81
|
token_hash = JSON.parse(response.body).with_indifferent_access
|
82
|
-
case token_hash[:token_type]
|
82
|
+
case token_hash[:token_type].try(:downcase)
|
83
83
|
when 'bearer'
|
84
84
|
AccessToken::Bearer.new(token_hash)
|
85
85
|
when 'mac'
|
@@ -88,6 +88,19 @@ describe Rack::OAuth2::Client do
|
|
88
88
|
its(:access_token) { should == 'access_token' }
|
89
89
|
its(:refresh_token) { should == 'refresh_token' }
|
90
90
|
its(:expires_in) { should == 3600 }
|
91
|
+
|
92
|
+
context 'when token type is "Bearer", not "bearer"' do
|
93
|
+
before do
|
94
|
+
client.authorization_code = 'code'
|
95
|
+
mock_response(
|
96
|
+
:post,
|
97
|
+
'https://server.example.com/oauth2/token',
|
98
|
+
'tokens/_Bearer.json'
|
99
|
+
)
|
100
|
+
end
|
101
|
+
it { should be_instance_of Rack::OAuth2::AccessToken::Bearer }
|
102
|
+
its(:token_type) { should == :bearer }
|
103
|
+
end
|
91
104
|
end
|
92
105
|
|
93
106
|
context 'when mac token is given' do
|
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.1
|
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-08-
|
13
|
+
date: 2011-08-14 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -187,6 +187,7 @@ files:
|
|
187
187
|
- spec/helpers/webmock_helper.rb
|
188
188
|
- spec/mock_response/errors/invalid_request.json
|
189
189
|
- spec/mock_response/resources/fake.txt
|
190
|
+
- spec/mock_response/tokens/_Bearer.json
|
190
191
|
- spec/mock_response/tokens/bearer.json
|
191
192
|
- spec/mock_response/tokens/legacy.json
|
192
193
|
- spec/mock_response/tokens/legacy.txt
|
@@ -259,6 +260,7 @@ test_files:
|
|
259
260
|
- spec/helpers/webmock_helper.rb
|
260
261
|
- spec/mock_response/errors/invalid_request.json
|
261
262
|
- spec/mock_response/resources/fake.txt
|
263
|
+
- spec/mock_response/tokens/_Bearer.json
|
262
264
|
- spec/mock_response/tokens/bearer.json
|
263
265
|
- spec/mock_response/tokens/legacy.json
|
264
266
|
- spec/mock_response/tokens/legacy.txt
|