Changed the default value of SSOAWSCredentialsOptions.SupportsGettingNewToken as false and improved error messaging if required SSO options are missing while generating new credentials. #3737
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Description
SSOAWSCredentialsOptions.SupportsGettingNewToken
asfalse
Test Scenarios:
Using Amazon.Extensions.NETCore.Setup package (customer's scenario)
Customer would use
aws sso login
and then rely onCredentialsProfileStoreChain
factoryIn this case, since now
SSOAWSCredentialsOptions.SupportsGettingNewToken
would resolve tofalse
, it would eventually throwAmazonClientException
with message:SSO Token has expired and failed to refresh
when token is expired.No valid SSO Token could be found.
where no token is found.Customer explicitly created SSO credentials (refer example at https://docs.aws.amazon.com/sdk-for-net/v3/developer-guide/sso-tutorial-app-only.html)
AWS Toolkit for Visual Studio and PowerShell already explicitly set
SSOAWSCredentialsOptions.SupportsGettingNewToken
totrue
.IMPORTANT: We would also need to update the examples in V4 developer guide at Tutorial for SSO using only .NET applications (this is a link from V3 developer guide, use similar link from V4 developer guide) to explicitly set
ssoCredentials.Options.SupportsGettingNewToken = true;
as the default value is false. (expand List Amazon S3 buckets and List IAM users collapsible sections)NOTE: There is perhaps another issue. The API documentation for Profile states that
Represents a profile in the configuration file. For example in ~/.aws/config [profile foo] name = value Profile profile = new Profile("foo"); When this is set on the ClientConfig and that config is passed to the service client constructor the sdk will try to find the credentials associated with the Profile.Name property If set, this will override AWS_PROFILE and AWSConfigs.ProfileName.
When I use code like below:
It doesn't consider the passed profile based on logic here (for V4) and here (for V3).
Motivation and Context
GitHub issue/discussion:
Testing
Dry-run
DRY_RUN-a741bd15-07fd-48e3-b260-603408b4134b
completed successfully.Screenshots (if appropriate)
Types of changes
Checklist
License