prx-ruby-aws-creds 0.1.6 → 0.2.0
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 +16 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cce824dd97bacb1eccc3f4c4613b45293c19b7d4bc5daa459dc7b92ab079c589
|
4
|
+
data.tar.gz: 1a5926a825795f2139f7359a333e5ecbb7a98bad19b3c3a7cb93f074fe679c99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffabc5525944d2bbe2fe016414942327a158802fec52d06cc721423b1d811e2decd622e58b5a967cac02480f1c6806bbb167a17587bff849dc986af59cbff66b
|
7
|
+
data.tar.gz: 497b5a132f0aef4249991a9fd1b5d11ee848c7de766bdeec8712c70aa8c78ba175fa97ebf53a0d735deb4a568aa279603d1732d308d8e001f3df2e1fa5e38005
|
data/lib/prx-ruby-aws-creds.rb
CHANGED
@@ -20,11 +20,11 @@ AWS_CONFIG_FILE = ENV["AWS_CONFIG_FILE"] || "#{Dir.home}/.aws/config"
|
|
20
20
|
# rid of the fancy typecasting.
|
21
21
|
class IniFile
|
22
22
|
class Parser
|
23
|
-
def typecast(
|
23
|
+
def typecast(value)
|
24
24
|
case value
|
25
|
-
when %r
|
26
|
-
when %r
|
27
|
-
when %r
|
25
|
+
when %r{\Atrue\z}i then true
|
26
|
+
when %r{\Afalse\z}i then false
|
27
|
+
when %r{\A\s*\z}i then nil
|
28
28
|
else
|
29
29
|
unescape_value(value)
|
30
30
|
end
|
@@ -80,11 +80,20 @@ 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
|
91
|
+
|
83
92
|
# The selected profile does not use SSO
|
84
|
-
return if !
|
93
|
+
return if !sso_start_url
|
85
94
|
|
86
95
|
# Get the SSO start URL for the selected profile
|
87
|
-
profile_start_url =
|
96
|
+
profile_start_url = sso_start_url
|
88
97
|
|
89
98
|
sso_access_token = sso_get_cached_access_token(profile_start_url)
|
90
99
|
|
@@ -144,7 +153,7 @@ class PrxRubyAwsCreds
|
|
144
153
|
aws_config_file = IniFile.load(AWS_CONFIG_FILE)
|
145
154
|
aws_config_file_section = aws_config_file["profile #{profile_name}"]
|
146
155
|
|
147
|
-
if aws_config_file_section["sso_role_name"]
|
156
|
+
if aws_config_file_section["sso_role_name"] || aws_config_file_section["sso_session"]
|
148
157
|
# For SSO profiles, call GetRoleCredentials with a role, account, and
|
149
158
|
# access token to get back a set of temporary credentials.
|
150
159
|
# https://docs.aws.amazon.com/singlesignon/latest/PortalAPIReference/API_GetRoleCredentials.html
|
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.
|
4
|
+
version: 0.2.0
|
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-
|
11
|
+
date: 2023-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inifile
|