prx-ruby-aws-creds 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/prx-ruby-aws-creds.rb +3 -9
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cce824dd97bacb1eccc3f4c4613b45293c19b7d4bc5daa459dc7b92ab079c589
4
- data.tar.gz: 1a5926a825795f2139f7359a333e5ecbb7a98bad19b3c3a7cb93f074fe679c99
3
+ metadata.gz: be6f99128dc5cd1c634799ec569f7da121872f9bcc9822f407e1fb37b2c700af
4
+ data.tar.gz: fa22d551a8ba6e663fc0856862ca7abe6821776042f3312a590024b3f6523cc2
5
5
  SHA512:
6
- metadata.gz: ffabc5525944d2bbe2fe016414942327a158802fec52d06cc721423b1d811e2decd622e58b5a967cac02480f1c6806bbb167a17587bff849dc986af59cbff66b
7
- data.tar.gz: 497b5a132f0aef4249991a9fd1b5d11ee848c7de766bdeec8712c70aa8c78ba175fa97ebf53a0d735deb4a568aa279603d1732d308d8e001f3df2e1fa5e38005
6
+ metadata.gz: 3b3451644c679537bda4b136b8e8e5d9526e7d3d507f2bbf30a435868f34bcf9b858c9f4f675efd48f84b129ce15260c4b7c19a5c6e146695d29a3ed90dfa292
7
+ data.tar.gz: da0c6bd5b54c1e131a84afcd7f49652138edf170f6960f005511521f93bb9191c4f7791ef10e86fab46f3ab66effdf83f8ed45bf69f5c6c09f749190b8c0489b
@@ -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,14 +1,14 @@
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.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Kalafarski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-02 00:00:00.000000000 Z
11
+ date: 2023-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inifile