oauth2 1.4.6 → 1.4.7
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/CHANGELOG.md +5 -1
- data/README.md +1 -0
- data/lib/oauth2/access_token.rb +3 -5
- data/lib/oauth2/version.rb +7 -3
- data/spec/helper.rb +37 -0
- data/spec/oauth2/access_token_spec.rb +216 -0
- data/spec/oauth2/authenticator_spec.rb +84 -0
- data/spec/oauth2/client_spec.rb +506 -0
- data/spec/oauth2/mac_token_spec.rb +117 -0
- data/spec/oauth2/response_spec.rb +90 -0
- data/spec/oauth2/strategy/assertion_spec.rb +58 -0
- data/spec/oauth2/strategy/auth_code_spec.rb +107 -0
- data/spec/oauth2/strategy/base_spec.rb +5 -0
- data/spec/oauth2/strategy/client_credentials_spec.rb +69 -0
- data/spec/oauth2/strategy/implicit_spec.rb +26 -0
- data/spec/oauth2/strategy/password_spec.rb +55 -0
- data/spec/oauth2/version_spec.rb +23 -0
- metadata +31 -31
- data/.document +0 -5
- data/.github/dependabot.yml +0 -8
- data/.github/workflows/style.yml +0 -37
- data/.github/workflows/test.yml +0 -58
- data/.gitignore +0 -19
- data/.jrubyrc +0 -1
- data/.rspec +0 -4
- data/.rubocop.yml +0 -112
- data/.rubocop_rspec.yml +0 -26
- data/.rubocop_todo.yml +0 -113
- data/.ruby-version +0 -1
- data/.travis.yml +0 -75
- data/CONTRIBUTING.md +0 -18
- data/Gemfile +0 -61
- data/Rakefile +0 -45
- data/gemfiles/jruby_1.7.gemfile +0 -11
- data/gemfiles/jruby_9.0.gemfile +0 -7
- data/gemfiles/jruby_9.1.gemfile +0 -3
- data/gemfiles/jruby_9.2.gemfile +0 -3
- data/gemfiles/jruby_head.gemfile +0 -3
- data/gemfiles/ruby_1.9.gemfile +0 -11
- data/gemfiles/ruby_2.0.gemfile +0 -6
- data/gemfiles/ruby_head.gemfile +0 -9
- data/gemfiles/truffleruby.gemfile +0 -3
- data/maintenance-branch +0 -1
- data/oauth2.gemspec +0 -52
@@ -0,0 +1,26 @@
|
|
1
|
+
describe OAuth2::Strategy::Implicit do
|
2
|
+
subject { client.implicit }
|
3
|
+
|
4
|
+
let(:client) { OAuth2::Client.new('abc', 'def', :site => 'http://api.example.com') }
|
5
|
+
|
6
|
+
describe '#authorize_url' do
|
7
|
+
it 'includes the client_id' do
|
8
|
+
expect(subject.authorize_url).to include('client_id=abc')
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'includes the type' do
|
12
|
+
expect(subject.authorize_url).to include('response_type=token')
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'includes passed in options' do
|
16
|
+
cb = 'http://myserver.local/oauth/callback'
|
17
|
+
expect(subject.authorize_url(:redirect_uri => cb)).to include("redirect_uri=#{Rack::Utils.escape(cb)}")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#get_token' do
|
22
|
+
it 'raises NotImplementedError' do
|
23
|
+
expect { subject.get_token }.to raise_error(NotImplementedError)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
describe OAuth2::Strategy::Password do
|
2
|
+
subject { client.password }
|
3
|
+
|
4
|
+
let(:client) do
|
5
|
+
cli = OAuth2::Client.new('abc', 'def', :site => 'http://api.example.com')
|
6
|
+
cli.connection.build do |b|
|
7
|
+
b.adapter :test do |stub|
|
8
|
+
stub.post('/oauth/token') do |env|
|
9
|
+
case @mode
|
10
|
+
when 'formencoded'
|
11
|
+
[200, {'Content-Type' => 'application/x-www-form-urlencoded'}, 'expires_in=600&access_token=salmon&refresh_token=trout']
|
12
|
+
when 'json'
|
13
|
+
[200, {'Content-Type' => 'application/json'}, '{"expires_in":600,"access_token":"salmon","refresh_token":"trout"}']
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
cli
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#authorize_url' do
|
22
|
+
it 'raises NotImplementedError' do
|
23
|
+
expect { subject.authorize_url }.to raise_error(NotImplementedError)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
%w[json formencoded].each do |mode|
|
28
|
+
describe "#get_token (#{mode})" do
|
29
|
+
before do
|
30
|
+
@mode = mode
|
31
|
+
@access = subject.get_token('username', 'password')
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'returns AccessToken with same Client' do
|
35
|
+
expect(@access.client).to eq(client)
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'returns AccessToken with #token' do
|
39
|
+
expect(@access.token).to eq('salmon')
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'returns AccessToken with #refresh_token' do
|
43
|
+
expect(@access.refresh_token).to eq('trout')
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'returns AccessToken with #expires_in' do
|
47
|
+
expect(@access.expires_in).to eq(600)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'returns AccessToken with #expires_at' do
|
51
|
+
expect(@access.expires_at).not_to be_nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe OAuth2::Version do
|
4
|
+
it 'has a version number' do
|
5
|
+
expect(described_class).not_to be nil
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'can be a string' do
|
9
|
+
expect(described_class.to_s).to be_a(String)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'allows Constant access' do
|
13
|
+
expect(described_class::VERSION).to be_a(String)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'is greater than 0.1.0' do
|
17
|
+
expect(Gem::Version.new(described_class) > Gem::Version.new('0.1.0')).to be(true)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'is not a pre-release' do
|
21
|
+
expect(Gem::Version.new(described_class).prerelease?).to be(false)
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oauth2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Boling
|
@@ -282,34 +282,10 @@ executables: []
|
|
282
282
|
extensions: []
|
283
283
|
extra_rdoc_files: []
|
284
284
|
files:
|
285
|
-
- ".document"
|
286
|
-
- ".github/dependabot.yml"
|
287
|
-
- ".github/workflows/style.yml"
|
288
|
-
- ".github/workflows/test.yml"
|
289
|
-
- ".gitignore"
|
290
|
-
- ".jrubyrc"
|
291
|
-
- ".rspec"
|
292
|
-
- ".rubocop.yml"
|
293
|
-
- ".rubocop_rspec.yml"
|
294
|
-
- ".rubocop_todo.yml"
|
295
|
-
- ".ruby-version"
|
296
|
-
- ".travis.yml"
|
297
285
|
- CHANGELOG.md
|
298
286
|
- CODE_OF_CONDUCT.md
|
299
|
-
- CONTRIBUTING.md
|
300
|
-
- Gemfile
|
301
287
|
- LICENSE
|
302
288
|
- README.md
|
303
|
-
- Rakefile
|
304
|
-
- gemfiles/jruby_1.7.gemfile
|
305
|
-
- gemfiles/jruby_9.0.gemfile
|
306
|
-
- gemfiles/jruby_9.1.gemfile
|
307
|
-
- gemfiles/jruby_9.2.gemfile
|
308
|
-
- gemfiles/jruby_head.gemfile
|
309
|
-
- gemfiles/ruby_1.9.gemfile
|
310
|
-
- gemfiles/ruby_2.0.gemfile
|
311
|
-
- gemfiles/ruby_head.gemfile
|
312
|
-
- gemfiles/truffleruby.gemfile
|
313
289
|
- lib/oauth2.rb
|
314
290
|
- lib/oauth2/access_token.rb
|
315
291
|
- lib/oauth2/authenticator.rb
|
@@ -324,16 +300,27 @@ files:
|
|
324
300
|
- lib/oauth2/strategy/implicit.rb
|
325
301
|
- lib/oauth2/strategy/password.rb
|
326
302
|
- lib/oauth2/version.rb
|
327
|
-
-
|
328
|
-
- oauth2.
|
303
|
+
- spec/helper.rb
|
304
|
+
- spec/oauth2/access_token_spec.rb
|
305
|
+
- spec/oauth2/authenticator_spec.rb
|
306
|
+
- spec/oauth2/client_spec.rb
|
307
|
+
- spec/oauth2/mac_token_spec.rb
|
308
|
+
- spec/oauth2/response_spec.rb
|
309
|
+
- spec/oauth2/strategy/assertion_spec.rb
|
310
|
+
- spec/oauth2/strategy/auth_code_spec.rb
|
311
|
+
- spec/oauth2/strategy/base_spec.rb
|
312
|
+
- spec/oauth2/strategy/client_credentials_spec.rb
|
313
|
+
- spec/oauth2/strategy/implicit_spec.rb
|
314
|
+
- spec/oauth2/strategy/password_spec.rb
|
315
|
+
- spec/oauth2/version_spec.rb
|
329
316
|
homepage: https://github.com/oauth-xx/oauth2
|
330
317
|
licenses:
|
331
318
|
- MIT
|
332
319
|
metadata:
|
333
320
|
bug_tracker_uri: https://github.com/oauth-xx/oauth2/issues
|
334
|
-
changelog_uri: https://github.com/oauth-xx/oauth2/blob/v1.4.
|
335
|
-
documentation_uri: https://www.rubydoc.info/gems/oauth2/1.4.
|
336
|
-
source_code_uri: https://github.com/oauth-xx/oauth2/tree/v1.4.
|
321
|
+
changelog_uri: https://github.com/oauth-xx/oauth2/blob/v1.4.7/CHANGELOG.md
|
322
|
+
documentation_uri: https://www.rubydoc.info/gems/oauth2/1.4.7
|
323
|
+
source_code_uri: https://github.com/oauth-xx/oauth2/tree/v1.4.7
|
337
324
|
wiki_uri: https://github.com/oauth-xx/oauth2/wiki
|
338
325
|
post_install_message:
|
339
326
|
rdoc_options: []
|
@@ -354,4 +341,17 @@ rubygems_version: 3.2.9
|
|
354
341
|
signing_key:
|
355
342
|
specification_version: 4
|
356
343
|
summary: A Ruby wrapper for the OAuth 2.0 protocol.
|
357
|
-
test_files:
|
344
|
+
test_files:
|
345
|
+
- spec/helper.rb
|
346
|
+
- spec/oauth2/client_spec.rb
|
347
|
+
- spec/oauth2/version_spec.rb
|
348
|
+
- spec/oauth2/authenticator_spec.rb
|
349
|
+
- spec/oauth2/mac_token_spec.rb
|
350
|
+
- spec/oauth2/access_token_spec.rb
|
351
|
+
- spec/oauth2/response_spec.rb
|
352
|
+
- spec/oauth2/strategy/password_spec.rb
|
353
|
+
- spec/oauth2/strategy/client_credentials_spec.rb
|
354
|
+
- spec/oauth2/strategy/assertion_spec.rb
|
355
|
+
- spec/oauth2/strategy/implicit_spec.rb
|
356
|
+
- spec/oauth2/strategy/auth_code_spec.rb
|
357
|
+
- spec/oauth2/strategy/base_spec.rb
|
data/.document
DELETED
data/.github/dependabot.yml
DELETED
data/.github/workflows/style.yml
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
name: Code Style Checks
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches:
|
6
|
-
- 'main'
|
7
|
-
- 'master'
|
8
|
-
- '*-maintenance'
|
9
|
-
- '*-dev'
|
10
|
-
tags:
|
11
|
-
- '!*' # Do not execute on tags
|
12
|
-
pull_request:
|
13
|
-
branches:
|
14
|
-
- '*'
|
15
|
-
|
16
|
-
jobs:
|
17
|
-
rubocop:
|
18
|
-
name: Rubocop
|
19
|
-
if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
|
20
|
-
strategy:
|
21
|
-
fail-fast: false
|
22
|
-
matrix:
|
23
|
-
ruby:
|
24
|
-
- 2.7
|
25
|
-
runs-on: ubuntu-20.04
|
26
|
-
steps:
|
27
|
-
- name: Checkout
|
28
|
-
uses: actions/checkout@v2
|
29
|
-
- name: Setup Ruby
|
30
|
-
uses: ruby/setup-ruby@v1
|
31
|
-
with:
|
32
|
-
ruby-version: ${{ matrix.ruby }}
|
33
|
-
bundler-cache: true
|
34
|
-
- name: Install dependencies
|
35
|
-
run: bundle install --jobs 3 --retry 3
|
36
|
-
- name: Run Rubocop
|
37
|
-
run: bundle exec rubocop -DESP
|
data/.github/workflows/test.yml
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
name: Unit Tests
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches:
|
6
|
-
- 'main'
|
7
|
-
- 'master'
|
8
|
-
- '*-maintenance'
|
9
|
-
- '*-dev'
|
10
|
-
tags:
|
11
|
-
- '!*' # Do not execute on tags
|
12
|
-
pull_request:
|
13
|
-
branches:
|
14
|
-
- '*'
|
15
|
-
|
16
|
-
jobs:
|
17
|
-
test:
|
18
|
-
name: Specs - Ruby ${{ matrix.ruby }} ${{ matrix.name_extra || '' }}
|
19
|
-
if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
|
20
|
-
strategy:
|
21
|
-
fail-fast: false
|
22
|
-
matrix:
|
23
|
-
ruby:
|
24
|
-
- 3.0.0
|
25
|
-
- 2.7
|
26
|
-
- 2.6
|
27
|
-
- 2.5
|
28
|
-
- 2.4
|
29
|
-
- 2.3
|
30
|
-
- 2.2
|
31
|
-
- 2.1
|
32
|
-
runs-on: ubuntu-20.04
|
33
|
-
continue-on-error: ${{ matrix.allow_failure || endsWith(matrix.ruby, 'head') }}
|
34
|
-
steps:
|
35
|
-
- uses: amancevice/setup-code-climate@v0
|
36
|
-
name: CodeClimate Install
|
37
|
-
if: matrix.ruby == '2.7' && github.event_name != 'pull_request'
|
38
|
-
with:
|
39
|
-
cc_test_reporter_id: ${{ secrets.CC_TEST_REPORTER_ID }}
|
40
|
-
- uses: actions/checkout@v2
|
41
|
-
- name: Setup Ruby
|
42
|
-
uses: ruby/setup-ruby@v1
|
43
|
-
with:
|
44
|
-
bundler: ${{ matrix.bundler || 2 }}
|
45
|
-
bundler-cache: true
|
46
|
-
ruby-version: ${{ matrix.ruby }}
|
47
|
-
- name: Install dependencies
|
48
|
-
run: bundle install --jobs 3 --retry 3 --binstubs --standalone
|
49
|
-
- name: CodeClimate Pre-build Notification
|
50
|
-
run: cc-test-reporter before-build
|
51
|
-
if: matrix.ruby == '2.7' && github.event_name != 'pull_request'
|
52
|
-
continue-on-error: ${{ matrix.allow_failures != 'false' }}
|
53
|
-
- name: Run tests
|
54
|
-
run: bundle exec rake test
|
55
|
-
- name: CodeClimate Post-build Notification
|
56
|
-
run: cc-test-reporter after-build
|
57
|
-
if: matrix.ruby == '2.7' && github.event_name != 'pull_request' && always()
|
58
|
-
continue-on-error: ${{ matrix.allow_failures != 'false' }}
|
data/.gitignore
DELETED
data/.jrubyrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
debug.fullTrace=true
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
inherit_from:
|
2
|
-
- .rubocop_todo.yml
|
3
|
-
- .rubocop_rspec.yml
|
4
|
-
|
5
|
-
require:
|
6
|
-
- 'rubocop-md'
|
7
|
-
- 'rubocop-packaging'
|
8
|
-
- 'rubocop-performance'
|
9
|
-
- 'rubocop-rake'
|
10
|
-
- 'rubocop-rspec'
|
11
|
-
|
12
|
-
AllCops:
|
13
|
-
NewCops: enable
|
14
|
-
DisplayCopNames: true # Display the name of the failing cops
|
15
|
-
Exclude:
|
16
|
-
- 'gemfiles/vendor/**/*'
|
17
|
-
- 'vendor/**/*'
|
18
|
-
- '**/.irbrc'
|
19
|
-
|
20
|
-
Metrics/BlockLength:
|
21
|
-
IgnoredMethods:
|
22
|
-
- context
|
23
|
-
- describe
|
24
|
-
- it
|
25
|
-
- shared_context
|
26
|
-
- shared_examples
|
27
|
-
- shared_examples_for
|
28
|
-
- namespace
|
29
|
-
- draw
|
30
|
-
|
31
|
-
Gemspec/RequiredRubyVersion:
|
32
|
-
Enabled: false
|
33
|
-
|
34
|
-
Metrics/BlockNesting:
|
35
|
-
Max: 2
|
36
|
-
|
37
|
-
Layout/LineLength:
|
38
|
-
Enabled: false
|
39
|
-
|
40
|
-
Metrics/ParameterLists:
|
41
|
-
Max: 4
|
42
|
-
|
43
|
-
Layout/AccessModifierIndentation:
|
44
|
-
EnforcedStyle: outdent
|
45
|
-
|
46
|
-
Layout/DotPosition:
|
47
|
-
EnforcedStyle: trailing
|
48
|
-
|
49
|
-
Layout/SpaceInsideHashLiteralBraces:
|
50
|
-
EnforcedStyle: no_space
|
51
|
-
|
52
|
-
Lint/UnusedBlockArgument:
|
53
|
-
Exclude:
|
54
|
-
- 'spec/**/*.rb'
|
55
|
-
- 'gemfiles/vendor/**/*'
|
56
|
-
- 'vendor/**/*'
|
57
|
-
- '**/.irbrc'
|
58
|
-
|
59
|
-
RSpec/DescribeClass:
|
60
|
-
Exclude:
|
61
|
-
- 'spec/examples/*'
|
62
|
-
|
63
|
-
RSpec/NestedGroups:
|
64
|
-
Enabled: false
|
65
|
-
|
66
|
-
Style/ClassVars:
|
67
|
-
Enabled: false
|
68
|
-
|
69
|
-
Style/CollectionMethods:
|
70
|
-
PreferredMethods:
|
71
|
-
map: 'collect'
|
72
|
-
reduce: 'inject'
|
73
|
-
find: 'detect'
|
74
|
-
find_all: 'select'
|
75
|
-
|
76
|
-
Style/Documentation:
|
77
|
-
Enabled: false
|
78
|
-
|
79
|
-
Style/DoubleNegation:
|
80
|
-
Enabled: false
|
81
|
-
|
82
|
-
Style/EmptyMethod:
|
83
|
-
EnforcedStyle: expanded
|
84
|
-
|
85
|
-
Style/Encoding:
|
86
|
-
Enabled: false
|
87
|
-
|
88
|
-
Style/TrailingCommaInArrayLiteral:
|
89
|
-
EnforcedStyleForMultiline: comma
|
90
|
-
|
91
|
-
Style/TrailingCommaInHashLiteral:
|
92
|
-
EnforcedStyleForMultiline: comma
|
93
|
-
|
94
|
-
Style/HashSyntax:
|
95
|
-
EnforcedStyle: hash_rockets
|
96
|
-
|
97
|
-
Style/Lambda:
|
98
|
-
Enabled: false
|
99
|
-
|
100
|
-
Style/SymbolArray:
|
101
|
-
Enabled: false
|
102
|
-
|
103
|
-
Style/EachWithObject:
|
104
|
-
Enabled: false
|
105
|
-
|
106
|
-
# Once we drop Rubies that lack support for __dir__ we can turn this on.
|
107
|
-
Style/ExpandPathArguments:
|
108
|
-
Enabled: false
|
109
|
-
|
110
|
-
# On Ruby 1.9 array.to_h isn't available, needs to be Hash[array]
|
111
|
-
Style/HashConversion:
|
112
|
-
Enabled: false
|