-
Notifications
You must be signed in to change notification settings - Fork 863
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
Expose expiration property on temporary STS credentials #3078
Comments
Appears to be useful feature request. Needs review with the team. |
@OnKey Please elaborate your use case. Credentials are refreshed automatically when RefreshingAWSCredentials are nearing expiration. |
@ashishdhingra the credentials are only refreshed if I call GetCredentials() every time I need to call an AWS endpoint. In this case, I need to pass the credentials (Access Key, Secret Key & Session token) to a 3rd party library and know when they need to be refreshed. The 3rd party library does not use the SDK directly, it just accepts a set of credentials to use when accessing AWS. |
I've hit the same limitation now. My use case is that we generate credentials for use with credentials_process, but to make that work well, we need to return the expiry date. It's frustrating that we can't get at it when it's clearly stored within the class. |
We just released the latest preview of V4 (https://www.nuget.org/packages/AWSSDK.SecurityToken/4.0.0-preview.9), and now there's an optional var sts = new AmazonSecurityTokenServiceClient();
var response = await sts.AssumeRoleAsync(new AssumeRoleRequest
{
RoleArn = "arn:aws:iam::111122223333:role/ReadOnly",
RoleSessionName = "read-only-session",
});
Console.WriteLine(response.Credentials.Expiration); |
Comments on closed issues are hard for our team to see. |
Describe the feature
Currently the expiry time for a token is not exposed when getting a temporary STS token. This property is stored as part of the CredentialsRefreshState is the class below. Could you look at adding this property into ImmutableCredentials or exposing it in some other way.
https://github.com/aws/aws-sdk-net/blob/main/sdk/src/Core/Amazon.Runtime/Credentials/RefreshingAWSCredentials.cs
Use Case
I need to know when I need to refresh temporary STS credentials and don't want to call GetCredentials() before every AWS API call in my application.
Proposed Solution
Add Expiration property into ImmutableCredentials and populate it in the Copy method where it exists.
https://github.com/aws/aws-sdk-net/blob/main/sdk/src/Core/Amazon.Runtime/Credentials/ImmutableCredentials.cs
Other Information
No response
Acknowledgements
AWS .NET SDK and/or Package version used
AWSSDK.SSO 3.7.100.83
Targeted .NET Platform
.NET 7
Operating System and version
Windows 10
The text was updated successfully, but these errors were encountered: