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 +4 -4
- data/lib/aptible/auth/version.rb +1 -1
- data/lib/oauth2/strategy/token_exchange.rb +1 -1
- data/spec/oauth2/lib/token_exchange_spec.rb +58 -0
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea651d922fcb32af2299bd0d1b5604719d2cbfcb394afb6a1de0ce092c5354de
|
4
|
+
data.tar.gz: 82a7f4f71e75404b484aee97e5d2fa8028e2b57b1c0359ea8133a5c0a3726434
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '069f1f5893a205704d2bbe3705b64c2c62c12072d6fbdba7ed5959163f6e0d6a80da7416d61420d7129dd292ce0734d0822cd06a05708f4c377dc1a27226caa1'
|
7
|
+
data.tar.gz: 482e8a2e3a50d1b68ee1fa2c60bc08355c873c0896af739cd09327c806087a3f0c664051f01620ca772137850d8c90d2232a87a798819b3034d4a3b6d7bdd118
|
data/lib/aptible/auth/version.rb
CHANGED
@@ -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.
|
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-
|
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
|