Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix - Load AWS profile from config if not provided as CLI arg #181

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

danielxia-sprout
Copy link

Proposed fix for #180, #155

profile comes from an optional command line argument --profile and could be None. AwsAuth is fine with profile=None being passed into the constructor in which case it falls back to the AWS profile from the configuration. However, that fallback within AwsAuth cannot change the value of profile, which are then incorrectly treated as the effective profile instead of a command line argument.

Testing

For #180, with the patch, it recognizes the profile from the configuration, instead of throwing a stack trace.

$  okta-awscli --okta-profile <some-profile> -v --debug 
DEBUG - Setting AWS role to ...
DEBUG - Setting AWS partition to AwsPartition.AWS
DEBUG - Setting AWS profile to production-apps
DEBUG - Checking STS token against ARN partition: AwsPartition.AWS
INFO - STS credentials are valid. Nothing to do.

For #155, it rotates the credentials when it is no longer valid

$ okta-awscli --okta-profile <some-profile> -v --debug 
DEBUG - Setting AWS role to ...
DEBUG - Setting AWS partition to AwsPartition.AWS
DEBUG - Setting AWS profile to production-apps
DEBUG - Checking STS token against ARN partition: AwsPartition.AWS
INFO - Temporary credentials have expired. Requesting new credentials.
DEBUG - Setting MFA factor to OKTA
INFO - App Link set as: ...

@maxtacu maxtacu changed the base branch from main to develop April 28, 2022 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant