File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -165,6 +165,7 @@ def main(argv):
165
165
# object to get a fresh SAMLResponse repeatedly and refresh our AWS
166
166
# Credentials.
167
167
session = None
168
+ role_selection = None
168
169
while True :
169
170
# If an AWS Session object has been created already, lets check if its
170
171
# still valid. If it is, sleep a bit and skip to the next execution of
@@ -174,16 +175,22 @@ def main(argv):
174
175
time .sleep (15 )
175
176
continue
176
177
178
+ log .info ('Getting SAML Assertion from {org}' .format (
179
+ org = config .org ))
180
+
177
181
try :
178
- # Only set up the session if it's still None
179
- if session is None :
180
- assertion = okta_client .get_assertion (appid = config .appid ,
181
- apptype = 'amazon_aws' )
182
- session = aws .Session (assertion , profile = config .name )
183
-
184
- log .info ('Getting SAML Assertion from {org}' .format (
185
- org = config .org ))
182
+ assertion = okta_client .get_assertion (appid = config .appid ,
183
+ apptype = 'amazon_aws' )
184
+ session = aws .Session (assertion , profile = config .name )
185
+
186
+ # If role_selection is set we're in a reup loop. Re-set the role on
187
+ # the session to prevent the user being prompted for the role again
188
+ # on each subsequent renewal.
189
+ if role_selection is not None :
190
+ session .set_role (role_selection )
191
+
186
192
session .assume_role ()
193
+
187
194
except aws .MultipleRoles :
188
195
log .warning ('Multiple AWS roles found; please select one' )
189
196
roles = session .available_roles ()
Original file line number Diff line number Diff line change 14
14
# Copyright 2018 Nathan V
15
15
16
16
17
- __version__ = '0.2.0 '
17
+ __version__ = '0.2.1 '
18
18
__desc__ = 'AWS Okta Keyman'
19
19
__desc_long__ = ('''
20
20
===============
You can’t perform that action at this time.
0 commit comments