rack-oauth2 1.7.1 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/VERSION +1 -1
- data/lib/rack/oauth2.rb +0 -1
- data/lib/rack/oauth2/client.rb +4 -9
- data/lib/rack/oauth2/server/abstract/error.rb +1 -1
- data/lib/rack/oauth2/server/token.rb +1 -1
- data/rack-oauth2.gemspec +0 -1
- data/spec/rack/oauth2/debugger/request_filter_spec.rb +1 -1
- metadata +1 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cda56e136be240ecb7faedac7e0069f25318b471
|
4
|
+
data.tar.gz: b3349a1fd8210e59df758b8f16fcf5c0dc186092
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b60bd49eda41862116792fe9d7b6a4a0015063604dc1ee4fc2bb785147d6ab7690064ef768017af6c91fe3591984c9ebe8d59c23acfb0a3d9bb5fcfc6984ed4
|
7
|
+
data.tar.gz: 18deba6a3040a76a2970f083b6d52de13f4f31b602027bdff064cdbb6ccd3cd2be2a996400a189c6c5a7ffe4a47672f3b8f98e253f44305d4997d36e482c5038
|
data/.travis.yml
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.8.0
|
data/lib/rack/oauth2.rb
CHANGED
data/lib/rack/oauth2/client.rb
CHANGED
@@ -122,7 +122,7 @@ module Rack
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def handle_success_response(response)
|
125
|
-
token_hash =
|
125
|
+
token_hash = JSON.parse(response.body).with_indifferent_access
|
126
126
|
case (@forced_token_type || token_hash[:token_type]).try(:downcase)
|
127
127
|
when 'bearer'
|
128
128
|
AccessToken::Bearer.new(token_hash)
|
@@ -133,22 +133,17 @@ module Rack
|
|
133
133
|
else
|
134
134
|
raise 'Unknown Token Type'
|
135
135
|
end
|
136
|
-
rescue
|
136
|
+
rescue JSON::ParserError
|
137
137
|
# NOTE: Facebook support (They don't use JSON as token response)
|
138
138
|
AccessToken::Legacy.new Rack::Utils.parse_nested_query(response.body).with_indifferent_access
|
139
139
|
end
|
140
140
|
|
141
141
|
def handle_error_response(response)
|
142
|
-
error =
|
142
|
+
error = JSON.parse(response.body).with_indifferent_access
|
143
143
|
raise Error.new(response.status, error)
|
144
|
-
rescue
|
144
|
+
rescue JSON::ParserError
|
145
145
|
raise Error.new(response.status, error: 'Unknown', error_description: response.body)
|
146
146
|
end
|
147
|
-
|
148
|
-
def parse_json(raw_json)
|
149
|
-
# MultiJson.parse('') returns nil when using MultiJson::Adapters::JsonGem
|
150
|
-
MultiJson.load(raw_json).try(:with_indifferent_access) || {}
|
151
|
-
end
|
152
147
|
end
|
153
148
|
end
|
154
149
|
end
|
@@ -28,7 +28,7 @@ module Rack
|
|
28
28
|
yield response if block_given?
|
29
29
|
unless response.redirect?
|
30
30
|
response.header['Content-Type'] = 'application/json'
|
31
|
-
response.write
|
31
|
+
response.write Util.compact_hash(protocol_params).to_json
|
32
32
|
end
|
33
33
|
response.finish
|
34
34
|
end
|
@@ -68,7 +68,7 @@ module Rack
|
|
68
68
|
|
69
69
|
def finish
|
70
70
|
attr_missing!
|
71
|
-
write
|
71
|
+
write Util.compact_hash(protocol_params).to_json
|
72
72
|
header['Content-Type'] = 'application/json'
|
73
73
|
header['Cache-Control'] = 'no-store'
|
74
74
|
header['Pragma'] = 'no-cache'
|
data/rack-oauth2.gemspec
CHANGED
@@ -15,7 +15,6 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.files = `git ls-files`.split("\n")
|
16
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
17
|
s.add_runtime_dependency "rack", ">= 1.1"
|
18
|
-
s.add_runtime_dependency "multi_json", ">= 1.3.6"
|
19
18
|
s.add_runtime_dependency "httpclient", ">= 2.4"
|
20
19
|
s.add_runtime_dependency "activesupport", ">= 2.3"
|
21
20
|
s.add_runtime_dependency "attr_required", ">= 0.0.5"
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Rack::OAuth2::Debugger::RequestFilter do
|
4
4
|
let(:resource_endpoint) { 'https://example.com/resources' }
|
5
5
|
let(:request) { HTTP::Message.new_request(:get, URI.parse(resource_endpoint)) }
|
6
|
-
let(:response) { HTTP::Message.new_response(
|
6
|
+
let(:response) { HTTP::Message.new_response({hello: 'world'}.to_json) }
|
7
7
|
let(:request_filter) { Rack::OAuth2::Debugger::RequestFilter.new }
|
8
8
|
|
9
9
|
describe '#filter_request' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nov matake
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.1'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: multi_json
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.3.6
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 1.3.6
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: httpclient
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|