-
Notifications
You must be signed in to change notification settings - Fork 868
Facilitate injection of AWSCredentials #3716
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
Comments
We might want to revisit this since |
@ashishdhingra thanks for your reply!
Can you help me understand how we could leverage
|
@ashishdhingra bump :-). Reminder that I've implemented this in #3715. |
I just encountered another scenario where I needed to obtain public class MyS3Client : AmazonS3Client
{
public MyS3Client(AWSCredentials credentials, AmazonS3Config clientConfig)
: base(credentials, clientConfig)
{
}
} |
Describe the feature
I'm hoping to inject into any class an instance of
AWSCredentials
. I'd like thisAWSCredentials
object to take into accountAmazon.Extensions.NETCore.Setup.AWSOptions
. The idea is that these credentials are resolved in the exact same way as the logic that creates ServiceClients.Use Case
Aside from copying
Amazon.Extensions.NETCore.Setup.CreateCredentials()
, how would I do the following?Class that makes a request against an endpoint that requires sigv4 headers:
Copy of
Amazon.Extensions.NETCore.Setup.CreateCredentials()
:Program.cs:
Test that verifies outbound call to endpoint requiring sigv4 headers:
Proposed Solution
AWSSDK.Extensions.NETCore.Setup
'sServiceCollectionExtensions
class to expose newAddCredentialsFactory()
methods that register a newIAWSCredentialsFactory
interface.ClientFactory..CreateCredentials()
to a newDefaultAWSCredentialsFactory
class.IAWSCredentialsFactory
can then be injected into any consumer's class (and by extension obtain anAWSCredentials
object).This has the added benefit that consumers can customize the behavior of credential creation to meet their needs by registering their own implementation of
IAWSCredentialsFactory
.Other Information
I've implemented these changes via PR #3715.
I believe that this would address #3461 and #3228.
Acknowledgements
AWS .NET SDK and/or Package version used
AWSSDK.Extensions.NETCore.Setup 3.7.400
Targeted .NET Platform
.NET 8
Operating System and version
macOS
The text was updated successfully, but these errors were encountered: