prx-ruby-aws-creds 0.2.0 → 0.2.1
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/prx-ruby-aws-creds.rb +3 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55c1ea017630660be48bf6f7d9eece87c6ddb490b061caa2aaaa833c931d4422
|
4
|
+
data.tar.gz: 490b11e27dd3308cd440e1958c042ba2995dfdd0a28c85cdf4e91428e2096922
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7e8f2ed835e8c6587ea19bd5b72819f95093d721bb1b02ef95a4cf0dab1aa9d7bead2f855c5f15ca3f35bc0d37d309ee173ebc6780464a5c3a6f3a426c40b0d
|
7
|
+
data.tar.gz: d4184c77fe9849bfadbfba679f68c897acff29133994253ae871cd00af132ae509b895f2dc5d9a158c11eebbe262bd36ec040b8b2f376905635e6e962b8ccd11
|
data/lib/prx-ruby-aws-creds.rb
CHANGED
@@ -80,14 +80,7 @@ class PrxRubyAwsCreds
|
|
80
80
|
aws_config_file = IniFile.load(AWS_CONFIG_FILE)
|
81
81
|
aws_config_file_section = aws_config_file["profile #{profile_name}"]
|
82
82
|
|
83
|
-
|
84
|
-
sso_session_name = aws_config_file["sso_session"]
|
85
|
-
sso_session_section = aws_config_file["sso-session #{sso_session_name}"]
|
86
|
-
|
87
|
-
sso_start_url = sso_session_section["sso_start_url"]
|
88
|
-
else
|
89
|
-
sso_start_url = aws_config_file_section["sso_start_url"]
|
90
|
-
end
|
83
|
+
sso_start_url = aws_config_file_section["sso_session"] ? aws_config_file["sso-session #{aws_config_file_section["sso_session"]}"]["sso_start_url"] : aws_config_file_section["sso_start_url"]
|
91
84
|
|
92
85
|
# The selected profile does not use SSO
|
93
86
|
return if !sso_start_url
|
@@ -158,8 +151,9 @@ class PrxRubyAwsCreds
|
|
158
151
|
# access token to get back a set of temporary credentials.
|
159
152
|
# https://docs.aws.amazon.com/singlesignon/latest/PortalAPIReference/API_GetRoleCredentials.html
|
160
153
|
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SSO/Client.html#get_role_credentials-instance_method
|
154
|
+
sso_region = aws_config_file_section["sso_session"] ? aws_config_file["sso-session #{aws_config_file_section["sso_session"]}"]["sso_region"] : aws_config_file_section["sso_region"]
|
161
155
|
opts = sso_get_role_options(profile_name)
|
162
|
-
sso = Aws::SSO::Client.new(region:
|
156
|
+
sso = Aws::SSO::Client.new(region: sso_region)
|
163
157
|
credentials = sso.get_role_credentials(opts)
|
164
158
|
|
165
159
|
# Cache the credentials. The structure of this file doesn't exactly
|