rack-oauth2 1.6.4 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -4
- data/VERSION +1 -1
- data/lib/rack/oauth2/client.rb +10 -12
- data/lib/rack/oauth2/server/abstract/error.rb +2 -2
- data/spec/rack/oauth2/server/resource/error_spec.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 209bd4160af15825baf09e8e51de40eca26b339e
|
4
|
+
data.tar.gz: e597b66535c13dbe4c2d0412c3360162bbfeb010
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1a9d718acc695b28e290f4da72eda80d158b7f6c39b94b82b6c4d02edc6e3bc9ad3d08c5c3eb4da1728a0a0ecc77ba994f4bc523c1fef6254d9ee3da3c63042
|
7
|
+
data.tar.gz: 180bab02141d632c431cc90c9520effcc28dd013a18eb4d14c1499bc3e4c97b1e87e772a945d83ba9b95ae36baf870b14bbc32959516b76eeb663dbab8c16ca1
|
data/.travis.yml
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.7.0
|
data/lib/rack/oauth2/client.rb
CHANGED
@@ -76,18 +76,16 @@ module Rack
|
|
76
76
|
params[:scope] = Array(options.delete(:scope)).join(' ') if options[:scope].present?
|
77
77
|
params.merge! options
|
78
78
|
|
79
|
-
if
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
)
|
90
|
-
end
|
79
|
+
if client_auth_method == :basic
|
80
|
+
cred = ["#{identifier}:#{secret}"].pack('m').tr("\n", '')
|
81
|
+
headers.merge!(
|
82
|
+
'Authorization' => "Basic #{cred}"
|
83
|
+
)
|
84
|
+
else
|
85
|
+
params.merge!(
|
86
|
+
client_id: identifier,
|
87
|
+
client_secret: secret
|
88
|
+
)
|
91
89
|
end
|
92
90
|
handle_response do
|
93
91
|
Rack::OAuth2.http_client.post(
|
@@ -53,13 +53,13 @@ module Rack
|
|
53
53
|
end
|
54
54
|
|
55
55
|
class ServerError < Error
|
56
|
-
def initialize(error = :
|
56
|
+
def initialize(error = :server_error, description = nil, options = {})
|
57
57
|
super 500, error, description, options
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
class TemporarilyUnavailable < Error
|
62
|
-
def initialize(error = :
|
62
|
+
def initialize(error = :temporarily_unavailable, description = nil, options = {})
|
63
63
|
super 503, error, description, options
|
64
64
|
end
|
65
65
|
end
|
@@ -57,6 +57,16 @@ describe Rack::OAuth2::Server::Resource::Unauthorized do
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
+
context 'when no error_code is given' do
|
61
|
+
let(:error) { Rack::OAuth2::Server::Resource::Unauthorized.new }
|
62
|
+
|
63
|
+
it 'should have error_code in body but not in WWW-Authenticate header' do
|
64
|
+
status, header, response = error_with_scheme.finish
|
65
|
+
header['WWW-Authenticate'].should == "Scheme realm=\"#{realm}\""
|
66
|
+
response.body.first.should == '{"error":"unauthorized"}'
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
60
70
|
context 'when realm is specified' do
|
61
71
|
let(:realm) { 'server.example.com' }
|
62
72
|
let(:error) { Rack::OAuth2::Server::Resource::Bearer::Unauthorized.new(:something, nil, realm: realm) }
|
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.
|
4
|
+
version: 1.7.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: 2017-
|
11
|
+
date: 2017-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|