aws-sdk-rust
aws-sdk-rust copied to clipboard
`aws-config` credentials providers inconsistently cache when explicitly configured
The default credentials chain has caching, and AssumeRoleCredentialsProvider has caching when set explicitly on SdkConfig. The rest of the credentials providers don't cache when set up explicitly though. Ideally, credentials providers would just always cache—one should not need to think about it. Even better if things are smart enough to not double-cache (does AssumeRoleCredentialsProvider add a redundant layer of caching to the default chain?).
The type system could potentially be used to enforce that caching is configured correctly. The SdkConfig could take a dyn CachingCredentialsProvider trait while all the credentials providers only implement CredentialsProvider. Then the caching wrappers such as LazyCachingCredentialsProvider could implement CachingCredentialsProvider. This would make it impossible to override credentials providers without caching, or if someone really wanted no caching, a manual implementation of CachingCredentialsProvider would be needed.
Closing this, as it's been implemented in https://github.com/awslabs/smithy-rs/pull/2122 (plus its follow-up https://github.com/awslabs/smithy-rs/pull/2227).
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.