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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d92edcb16d7166257558b555867bfc52c1770514
4
- data.tar.gz: 25d1d5ee07b9fe8d2f50c93b6b6384439ef53053
3
+ metadata.gz: cda56e136be240ecb7faedac7e0069f25318b471
4
+ data.tar.gz: b3349a1fd8210e59df758b8f16fcf5c0dc186092
5
5
  SHA512:
6
- metadata.gz: 04d1fa45e23b7f7eafc051c84eb6d08df5234ee31c14cf06e1951df8a6a53cba636145649fbd748e7f610911b22a984a928166eb0f37e39b0d049d6b599b3de7
7
- data.tar.gz: 5a45856133aed0ce20e9d8c5db3ebff15d2b5524c4bbb44a3731bf6986ce8ae5bb65f7125cba6bcdac9f14d808dc980c8ae7f5640330b522c37a428b82ea7e3f
6
+ metadata.gz: 6b60bd49eda41862116792fe9d7b6a4a0015063604dc1ee4fc2bb785147d6ab7690064ef768017af6c91fe3591984c9ebe8d59c23acfb0a3d9bb5fcfc6984ed4
7
+ data.tar.gz: 18deba6a3040a76a2970f083b6d52de13f4f31b602027bdff064cdbb6ccd3cd2be2a996400a189c6c5a7ffe4a47672f3b8f98e253f44305d4997d36e482c5038
data/.travis.yml CHANGED
@@ -2,5 +2,6 @@ before_install:
2
2
  - gem install bundler
3
3
 
4
4
  rvm:
5
- - 2.3.5
6
- - 2.4.2
5
+ - 2.3.6
6
+ - 2.4.3
7
+ - 2.5.0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.1
1
+ 1.8.0
data/lib/rack/oauth2.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'rack'
2
- require 'multi_json'
3
2
  require 'httpclient'
4
3
  require 'logger'
5
4
  require 'active_support'
@@ -122,7 +122,7 @@ module Rack
122
122
  end
123
123
 
124
124
  def handle_success_response(response)
125
- token_hash = parse_json response.body
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 MultiJson::DecodeError
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 = parse_json response.body
142
+ error = JSON.parse(response.body).with_indifferent_access
143
143
  raise Error.new(response.status, error)
144
- rescue MultiJson::DecodeError
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 MultiJson.dump(Util.compact_hash(protocol_params))
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 MultiJson.dump(Util.compact_hash(protocol_params))
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(MultiJson.dump({hello: 'world'})) }
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.7.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