-
Notifications
You must be signed in to change notification settings - Fork 865
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
Introduce AddCredentialsFactory() extension methods #3715
base: main
Are you sure you want to change the base?
Introduce AddCredentialsFactory() extension methods #3715
Conversation
Is there an existing issue with more details on the problem you're trying to solve? We made significant changes to both the |
Nope I haven't created an issue, but I'd be happy to do so. What additional detail are you looking for? Maybe code samples?
How should it change so that it can be reviewed? |
P.S. Would it be better if I opened a PR that targets a v4 branch? I looked at the |
@dscpinheiro FYI that I just created issue #3716 to provide additional context. Let me know if it makes sense to implement these changes against the |
@dscpinheiro bump :-) |
…k breaks FallbackCredentialsFactory's assumptions RefreshingAWSCredentials will throw an exception if it's been disposed of (and used via FallbackCredentialsFactory)
4014711
to
288b90e
Compare
The feature of having an opt-in mechanism on A question I have is should we injecting |
Description
This PR updates the AWSSDK.Extensions.NETCore.Setup nuget package with the following:
IServiceCollection.[Try]AddCredentialsFactory
extension methodsDefaultAWSCredentialsFactory
that is effectively a move of the privateClientFactory.CreateCredentials
methodClientFactory
to use the injectedIAWSCredentialsFactory
AWSCredentials
so that it can be injected by consuming code.Motivation and Context
There are scenarios where it's necessary to obtain
AWSCredentials
. One scenario is adding sigv4 headers when making RESTful calls using the idiomaticHttpClient
; as an aside I happen to be using the AwsSignatureVersion4 nuget package for this. Today a consumer has to effectively copy theClientFactory.CreateCredentials
method to be able to register anAWSCredentials
object that is created in a way that leveragesAWSOptions
. With these changes a consumer simply needs to callservices.AddCredentialsFactory()
and then injectAWSOptions
where needed.These updates also provide a hook for a consumer to customize the way in which
AWSCredentials
are provided to ServiceClients.Testing
I added 10 unit tests to the
DependencyInjectionTests
. I'm also using what is effectively a fork with these changes in production code.Types of changes
Checklist
License