Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions gimme_aws_creds/okta.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,14 @@ def _next_login_step(self, state_token, login_data):
return self._check_push_result(state_token, login_data)
else:
return self._login_input_mfa_challenge(state_token, login_data['_links']['next']['href'])
elif status == 'PASSWORD_EXPIRED':
if self.KEYRING_ENABLED:
try:
creds = self._get_username_password_creds()
keyring.delete_password(self.KEYRING_SERVICE, creds['username'])
raise errors.GimmeAWSCredsError('Stored password is expired and has been cleared from keyring. Please try again')
except PasswordDeleteError:
raise errors.GimmeAWSCredsError('Stored password is expired but got error deleting it from keyring. Please try again')
else:
raise RuntimeError('Unknown login status: ' + status)

Expand Down