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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/prx-ruby-aws-creds.rb +3 -9
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cce824dd97bacb1eccc3f4c4613b45293c19b7d4bc5daa459dc7b92ab079c589
4
- data.tar.gz: 1a5926a825795f2139f7359a333e5ecbb7a98bad19b3c3a7cb93f074fe679c99
3
+ metadata.gz: 55c1ea017630660be48bf6f7d9eece87c6ddb490b061caa2aaaa833c931d4422
4
+ data.tar.gz: 490b11e27dd3308cd440e1958c042ba2995dfdd0a28c85cdf4e91428e2096922
5
5
  SHA512:
6
- metadata.gz: ffabc5525944d2bbe2fe016414942327a158802fec52d06cc721423b1d811e2decd622e58b5a967cac02480f1c6806bbb167a17587bff849dc986af59cbff66b
7
- data.tar.gz: 497b5a132f0aef4249991a9fd1b5d11ee848c7de766bdeec8712c70aa8c78ba175fa97ebf53a0d735deb4a568aa279603d1732d308d8e001f3df2e1fa5e38005
6
+ metadata.gz: d7e8f2ed835e8c6587ea19bd5b72819f95093d721bb1b02ef95a4cf0dab1aa9d7bead2f855c5f15ca3f35bc0d37d309ee173ebc6780464a5c3a6f3a426c40b0d
7
+ data.tar.gz: d4184c77fe9849bfadbfba679f68c897acff29133994253ae871cd00af132ae509b895f2dc5d9a158c11eebbe262bd36ec040b8b2f376905635e6e962b8ccd11
@@ -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
- if aws_config_file["sso_session"]
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: aws_config_file_section["sso_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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prx-ruby-aws-creds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Kalafarski