aptible-auth 0.11.2 → 0.11.3
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/lib/aptible/auth/token.rb +9 -4
- data/lib/aptible/auth/version.rb +1 -1
- data/spec/aptible/auth/token_spec.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93d75943842f3e5ed625c2da64dc0c7ee83ffd69
|
4
|
+
data.tar.gz: 84e6d466d82a90fb85060294a5b93f1a9702925d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73d27eeac4954a579d97e8148f23f1a96316825e7b95c6641870db5296b6a5bdbf789e0ff12a587fc3e7cb0536c6a4d457ca2fb8a58b15f9e7950f47657a8a86
|
7
|
+
data.tar.gz: bd1bf9f3fd30a2d2196807507a754c9183d85a9fc0f6cdf424f465caf837b30958e13a6793fc7fcf94b5dc0fa28024fb98361e2f4ccac5b878624c6eb40a8412
|
data/lib/aptible/auth/token.rb
CHANGED
@@ -26,7 +26,7 @@ module Aptible
|
|
26
26
|
parse_oauth_response(response)
|
27
27
|
end
|
28
28
|
|
29
|
-
def authenticate_impersonate(
|
29
|
+
def authenticate_impersonate(subject_token, subject_token_type, options)
|
30
30
|
# TODO: This duplicates aptible-resource, is it worth extracting?
|
31
31
|
token = case token = options.delete(:token)
|
32
32
|
when Aptible::Resource::Base then token.access_token
|
@@ -39,7 +39,7 @@ module Aptible
|
|
39
39
|
options[:scope] ||= 'manage'
|
40
40
|
response = oauth.token_exchange.get_token(
|
41
41
|
token, 'urn:ietf:params:oauth:token-type:jwt',
|
42
|
-
|
42
|
+
subject_token, subject_token_type, options)
|
43
43
|
parse_oauth_response(response)
|
44
44
|
end
|
45
45
|
|
@@ -49,6 +49,7 @@ module Aptible
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def process_options(options)
|
52
|
+
options = options.dup
|
52
53
|
if (email = options.delete(:email)) &&
|
53
54
|
(password = options.delete(:password))
|
54
55
|
authenticate_user(email, password, options)
|
@@ -56,8 +57,12 @@ module Aptible
|
|
56
57
|
(client_secret = options.delete(:client_secret)) &&
|
57
58
|
(subject = options.delete(:subject))
|
58
59
|
authenticate_client(client_id, client_secret, subject, options)
|
59
|
-
elsif (
|
60
|
-
authenticate_impersonate(
|
60
|
+
elsif (href = options.delete(:user_href))
|
61
|
+
authenticate_impersonate(href, 'aptible:user:href', options)
|
62
|
+
elsif (href = options.delete(:organization_href))
|
63
|
+
authenticate_impersonate(href, 'aptible:organization:href', options)
|
64
|
+
elsif (email = options.delete(:user_email))
|
65
|
+
authenticate_impersonate(email, 'aptible:user:email', options)
|
61
66
|
else
|
62
67
|
fail 'Unrecognized options'
|
63
68
|
end
|
data/lib/aptible/auth/version.rb
CHANGED
@@ -27,6 +27,13 @@ describe Aptible::Auth::Token do
|
|
27
27
|
subject: 'user@example.com'
|
28
28
|
)
|
29
29
|
end
|
30
|
+
|
31
|
+
it 'should not alter the hash it receives' do
|
32
|
+
options = { email: 'some email' }
|
33
|
+
options_before = options.dup
|
34
|
+
expect { described_class.create options }.to raise_error(/Unrecognized/)
|
35
|
+
expect(options).to eq(options_before)
|
36
|
+
end
|
30
37
|
end
|
31
38
|
|
32
39
|
describe '#initialize' do
|
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: 0.11.
|
4
|
+
version: 0.11.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Macreery
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aptible-billing
|