Skip to content
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

CredentialProviderChain refactor #62

Merged
merged 14 commits into from
Oct 4, 2024
Merged

CredentialProviderChain refactor #62

merged 14 commits into from
Oct 4, 2024

Conversation

mullermp
Copy link
Collaborator

Prototype moving providers to service gems

@mullermp mullermp changed the title Move assume role providers to STS CredentialProviderChain refactor Sep 21, 2024
@@ -49,12 +49,18 @@ public List<ClientConfig> getAdditionalClientConfig(GenerationContext context) {
@see AWS::SDK::Core::CREDENTIALS_PROVIDER_CHAIN
""";

String identityProviderChain = "AWS::SDK::Core::HTTPBearerProviderChain";
String defaultIdentity = "Hearth::Identities::HTTPBearer.new(token: 'token')";
String defaultConfigValue = "cfg[:stub_responses] ? %s.new(proc { %s }) : nil"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming nit: calling it defaultConfig value is a little confusing here to me since this is only for stubbed responses.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a default value though.. either nil or a stub response.

"sessionToken": "0"
}
},
"expected": {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not really related - but should account_id resolution be included in this as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly but I think we should test cred providers resolution only.

Copy link
Owner

@alextwoods alextwoods left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice - looking good overall - I like the new CredentialsProviderChain class approach.

module CredentialsProviderChain
def self.call(config)
class CredentialsProviderChain < Hearth::IdentityProvider
def initialize(config)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way we're initializing this from the _defaults with the cfg provided by the resolver... this won't actually be the config, it will be the Config Resolver right? Is there any risk or issues in keeping that around instead of using the resolved config?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I think it should be fine. I do think after discussion that we want to cache providers based on config inputs, so that a new profile or some value that influences credential providers when given per operation, resolves a new provider in the chain.

Gemfile Outdated Show resolved Hide resolved
@@ -9,16 +9,18 @@ def initialize(config)
end

def identity(_properties = {})
return @identity if @identity
# TODO: cache the provider based on config keys - so that operation
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still on the fence on this one and not entirely convinced that we should redo default resolution based on operation config overrides.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's useful and correct to respect operation overrides for things like profile, region, credentials, etc, and we should re-resolve chain in that case.

@mullermp mullermp merged commit e3a8509 into main Oct 4, 2024
9 checks passed
@mullermp mullermp deleted the prototype-customization branch October 4, 2024 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants