rack-oauth2 1.0.5 → 1.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90fa661cf571c18624c58c6dfe85a3616809075f
4
- data.tar.gz: db05caa92211bc5ce751fb85ab4ccac4e1838da0
3
+ metadata.gz: d4f8ab7573542af30fbe99bfd06a10c441bfd525
4
+ data.tar.gz: 842c686858c196d10450911d8dfc6122f765914a
5
5
  SHA512:
6
- metadata.gz: 50a031423c464511fba404360d87caf811b865996e1d9e569a397ad301fd7aab51c5742022e015264a01db6f1321290feb6c6aa793f0af0bd372241297ea4803
7
- data.tar.gz: 72be0f93db4b6e023de1ae3a98bf779603b2d3a426bf4c06698f65b15db340364a6a1588c613e49a01eb9a3cded31a26f0fdae376cbf4f98ada02e169dadaf11
6
+ metadata.gz: bca0b37a82253f9246926bd47438580da3f006d06280e3a211dab8c446737fe147c9d4906c09a5df28b331006c2c89adc692ba66ac17984405e606d42317f2db
7
+ data.tar.gz: 3a0ce7a0ae2b2fd0d8e152e011fa5d054b304293f5674c5ffc3e64224639648658d8cb1851d06e39f0188c3c694df1b1cf6ec52fa7eb8c728d523ddd76bf453c
@@ -1,4 +1,3 @@
1
1
  rvm:
2
- - 1.8.7
3
- - 1.9.2
4
2
  - 1.9.3
3
+ - 2.0.0
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ if RUBY_VERSION >= '1.9'
13
13
  end
14
14
  end
15
15
  task :spec do
16
- Rake::Task['cover_me:report'].invoke
16
+ Rake::Task['cover_me:report'].invoke unless ENV['TRAVIS_RUBY_VERSION']
17
17
  end
18
18
  else
19
19
  RSpec::Core::RakeTask.new(:rcov) do |spec|
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.5
1
+ 1.0.6
@@ -45,8 +45,17 @@ module Rack
45
45
  )
46
46
  end
47
47
 
48
- def access_token!(client_auth_method = :basic)
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.5
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-05-14 00:00:00.000000000 Z
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.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: