aptible-auth 1.2.1 → 1.2.2

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
  SHA256:
3
- metadata.gz: 7149e22dc5b4312e17d2b6c3ba4ca28f66be30dfa279639caa2d44277019e121
4
- data.tar.gz: eb4361df78b1cace82024b72c67f270f1c93a013f3f21a6a5fbe6b3f9d2aeff1
3
+ metadata.gz: ea651d922fcb32af2299bd0d1b5604719d2cbfcb394afb6a1de0ce092c5354de
4
+ data.tar.gz: 82a7f4f71e75404b484aee97e5d2fa8028e2b57b1c0359ea8133a5c0a3726434
5
5
  SHA512:
6
- metadata.gz: 0df7b7e3c90027786a38571116d4c142ccb2bf7a8bcb346893cd5e1f8b3316ecee7facf2d6aa465f444da8d79a4aaf91ca3f164d74c589003648655ab858c2e7
7
- data.tar.gz: dcc58a8174e38ae47d2af44bed42dd1cea0b4dd9981cdde4a96b1069b5881e2cd34ce367b4fc1367f21798079b157254d4ae341848bcb9cf96ae7f119204a2f5
6
+ metadata.gz: '069f1f5893a205704d2bbe3705b64c2c62c12072d6fbdba7ed5959163f6e0d6a80da7416d61420d7129dd292ce0734d0822cd06a05708f4c377dc1a27226caa1'
7
+ data.tar.gz: 482e8a2e3a50d1b68ee1fa2c60bc08355c873c0896af739cd09327c806087a3f0c664051f01620ca772137850d8c90d2232a87a798819b3034d4a3b6d7bdd118
@@ -1,5 +1,5 @@
1
1
  module Aptible
2
2
  module Auth
3
- VERSION = '1.2.1'.freeze
3
+ VERSION = '1.2.2'.freeze
4
4
  end
5
5
  end
@@ -25,7 +25,7 @@ module OAuth2
25
25
  'actor_token_type' => actor_token_type,
26
26
  'subject_token' => subject_token,
27
27
  'subject_token_type' => subject_token_type
28
- }.merge(client_params).merge(params)
28
+ }.merge(params)
29
29
  @client.get_token(params, opts)
30
30
  end
31
31
  end
@@ -0,0 +1,58 @@
1
+ # rubocop:disable all
2
+ require 'oauth2'
3
+ require 'oauth2/strategy/token_exchange'
4
+ RSpec.describe OAuth2::Strategy::TokenExchange do
5
+ let(:client) do
6
+ cli = OAuth2::Client.new('abc', 'def', :site => 'http://api.example.com')
7
+ cli.connection.build do |b|
8
+ b.adapter :test do |stub|
9
+ stub.post('/oauth/token') do |env|
10
+ case @mode
11
+ when 'formencoded'
12
+ [200, {'Content-Type' => 'application/x-www-form-urlencoded'}, 'expires_in=600&access_token=salmon&refresh_token=trout']
13
+ when 'json'
14
+ [200, {'Content-Type' => 'application/json'}, '{"expires_in":600,"access_token":"salmon","refresh_token":"trout"}']
15
+ end
16
+ end
17
+ end
18
+ end
19
+ cli
20
+ end
21
+ subject { client.token_exchange }
22
+
23
+ describe '#authorize_url' do
24
+ it 'raises NotImplementedError' do
25
+ expect { subject.authorize_url }.to raise_error(NotImplementedError)
26
+ end
27
+ end
28
+
29
+ %w(json formencoded).each do |mode|
30
+ describe "#get_token (#{mode})" do
31
+ before do
32
+ @mode = mode
33
+ @access = subject.get_token('actor token', 'actor token type', 'subject token', 'subject token type')
34
+ end
35
+
36
+ it 'returns AccessToken with same Client' do
37
+ expect(@access.client).to eq(client)
38
+ end
39
+
40
+ it 'returns AccessToken with #token' do
41
+ expect(@access.token).to eq('salmon')
42
+ end
43
+
44
+ it 'returns AccessToken with #refresh_token' do
45
+ expect(@access.refresh_token).to eq('trout')
46
+ end
47
+
48
+ it 'returns AccessToken with #expires_in' do
49
+ expect(@access.expires_in).to eq(600)
50
+ end
51
+
52
+ it 'returns AccessToken with #expires_at' do
53
+ expect(@access.expires_at).not_to be_nil
54
+ end
55
+ end
56
+ end
57
+
58
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aptible-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Macreery
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-18 00:00:00.000000000 Z
11
+ date: 2020-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aptible-resource
@@ -176,13 +176,14 @@ files:
176
176
  - spec/aptible/auth/token_spec.rb
177
177
  - spec/aptible/auth/user_spec.rb
178
178
  - spec/aptible/auth_spec.rb
179
+ - spec/oauth2/lib/token_exchange_spec.rb
179
180
  - spec/shared/set_env.rb
180
181
  - spec/spec_helper.rb
181
182
  homepage: https://github.com/aptible/aptible-auth-ruby
182
183
  licenses:
183
184
  - MIT
184
185
  metadata: {}
185
- post_install_message:
186
+ post_install_message:
186
187
  rdoc_options: []
187
188
  require_paths:
188
189
  - lib
@@ -198,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
199
  version: '0'
199
200
  requirements: []
200
201
  rubygems_version: 3.1.3
201
- signing_key:
202
+ signing_key:
202
203
  specification_version: 4
203
204
  summary: Ruby client for auth.aptible.com
204
205
  test_files:
@@ -208,5 +209,6 @@ test_files:
208
209
  - spec/aptible/auth/token_spec.rb
209
210
  - spec/aptible/auth/user_spec.rb
210
211
  - spec/aptible/auth_spec.rb
212
+ - spec/oauth2/lib/token_exchange_spec.rb
211
213
  - spec/shared/set_env.rb
212
214
  - spec/spec_helper.rb