-
Notifications
You must be signed in to change notification settings - Fork 865
Introduce AddCredentialsFactory() extension methods #3715
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
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 |
@normj I created a series of draft PRs that target
I would probably only do 3+. The 6th in that list is a can of worms, but I figured I'd share it as imo it offers a lot of flexibility to the consumer; it might be advantageous to split
I (think I) implemented this in the 5th PR in the list above. Does that align with what you're thinking? This seems cleaner to me than creating another type but I haven't tested. I created #3758 for 5 that targets the
I'm with you there. It also gets a little awkward with Note that I ran across an issue with registering Thoughts on any of these iterations? |
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