rack-oauth2 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/rack/oauth2/client.rb +10 -1
- data/spec/rack/oauth2/client_spec.rb +18 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4f8ab7573542af30fbe99bfd06a10c441bfd525
|
4
|
+
data.tar.gz: 842c686858c196d10450911d8dfc6122f765914a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bca0b37a82253f9246926bd47438580da3f006d06280e3a211dab8c446737fe147c9d4906c09a5df28b331006c2c89adc692ba66ac17984405e606d42317f2db
|
7
|
+
data.tar.gz: 3a0ce7a0ae2b2fd0d8e152e011fa5d054b304293f5674c5ffc3e64224639648658d8cb1851d06e39f0188c3c694df1b1cf6ec52fa7eb8c728d523ddd76bf453c
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.6
|
data/lib/rack/oauth2/client.rb
CHANGED
@@ -45,8 +45,17 @@ module Rack
|
|
45
45
|
)
|
46
46
|
end
|
47
47
|
|
48
|
-
def access_token!(
|
48
|
+
def access_token!(*args)
|
49
49
|
headers, params = {}, @grant.as_json
|
50
|
+
|
51
|
+
# NOTE:
|
52
|
+
# Using Array#estract_options! for backward compatibility.
|
53
|
+
# Until v1.0.5, the first argument was 'client_auth_method' in scalar.
|
54
|
+
options = args.extract_options!
|
55
|
+
client_auth_method = args.first || options[:client_auth_method] || :basic
|
56
|
+
|
57
|
+
params[:scope] = Array(options[:scope]).join(' ') if options[:scope].present?
|
58
|
+
|
50
59
|
if secret && client_auth_method == :basic
|
51
60
|
cred = ["#{identifier}:#{secret}"].pack('m').tr("\n", '')
|
52
61
|
headers.merge!(
|
@@ -96,7 +96,7 @@ describe Rack::OAuth2::Client do
|
|
96
96
|
client.access_token!
|
97
97
|
end
|
98
98
|
|
99
|
-
context 'when' do
|
99
|
+
context 'when other auth method specified' do
|
100
100
|
it do
|
101
101
|
mock_response(
|
102
102
|
:post,
|
@@ -115,6 +115,23 @@ describe Rack::OAuth2::Client do
|
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
+
describe 'scopes' do
|
119
|
+
context 'when scope option given' do
|
120
|
+
it 'should specify given scope' do
|
121
|
+
mock_response(
|
122
|
+
:post,
|
123
|
+
'https://server.example.com/oauth2/token',
|
124
|
+
'tokens/bearer.json',
|
125
|
+
:params => {
|
126
|
+
:grant_type => 'client_credentials',
|
127
|
+
:scope => 'a b'
|
128
|
+
}
|
129
|
+
)
|
130
|
+
client.access_token! :scope => [:a, :b]
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
118
135
|
context 'when bearer token is given' do
|
119
136
|
before do
|
120
137
|
client.authorization_code = 'code'
|
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.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nov matake
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -268,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
268
268
|
version: 1.3.6
|
269
269
|
requirements: []
|
270
270
|
rubyforge_project:
|
271
|
-
rubygems_version: 2.0.
|
271
|
+
rubygems_version: 2.0.3
|
272
272
|
signing_key:
|
273
273
|
specification_version: 4
|
274
274
|
summary: OAuth 2.0 Server & Client Library - Both Bearer and MAC token type are supported
|
@@ -321,4 +321,3 @@ test_files:
|
|
321
321
|
- spec/rack/oauth2/server/token_spec.rb
|
322
322
|
- spec/rack/oauth2/util_spec.rb
|
323
323
|
- spec/spec_helper.rb
|
324
|
-
has_rdoc:
|