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

set credentials_provider not working #972

Closed
MrCroxx opened this issue Nov 24, 2023 · 2 comments
Closed

set credentials_provider not working #972

MrCroxx opened this issue Nov 24, 2023 · 2 comments
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@MrCroxx
Copy link

MrCroxx commented Nov 24, 2023

Describe the bug

When building config for client, Builder::credentials_provider does the following things:

/// Sets the credentials provider for this service
    pub fn credentials_provider(
        mut self,
        credentials_provider: impl crate::config::ProvideCredentials + 'static,
    ) -> Self {
        self.set_credentials_provider(::std::option::Option::Some(
            crate::config::SharedCredentialsProvider::new(credentials_provider),
        ));
        self
    }
    /// Sets the credentials provider for this service
    pub fn set_credentials_provider(
        &mut self,
        credentials_provider: ::std::option::Option<crate::config::SharedCredentialsProvider>,
    ) -> &mut Self {
        if let Some(credentials_provider) = credentials_provider {
            #[cfg(feature = "sigv4a")]
            {
                self.runtime_components.push_identity_resolver(
                    ::aws_runtime::auth::sigv4a::SCHEME_ID,
                    credentials_provider.clone(),
                );
            }
            self.runtime_components.push_identity_resolver(
                ::aws_runtime::auth::sigv4::SCHEME_ID,
                credentials_provider,
            );
        }
        self
    }

credientials_provider is set by runtime_components. But after build, Config::credientials_provider does this:

/// Returns the credentials provider for this service
    pub fn credentials_provider(&self) -> Option<crate::config::SharedCredentialsProvider> {
        self.config
            .load::<crate::config::SharedCredentialsProvider>()
            .cloned()
    }

It loads credentials provider from its config field not runtime_components. So it is always None. And I cannot make my hard-coded credentials for minio test env work.

Expected Behavior

Builder::credentials_provider set the right field or Config::credentials_provider get from the right field.

Current Behavior

Builder::credentials_provider set runtime_components but Config::credentials_provider get from config.

Reproduction Steps

Set any credentials provider and get, got None.

Possible Solution

As mentioned.

Additional Information/Context

No response

Version

├── aws-credential-types v1.0.0
    │   ├── aws-smithy-async v1.0.1
    │   ├── aws-smithy-runtime-api v1.0.1
    │   │   ├── aws-smithy-async v1.0.1 (*)
    │   │   ├── aws-smithy-types v1.0.1
    │   ├── aws-smithy-types v1.0.1 (*)
    ├── aws-runtime v1.0.0
    │   ├── aws-credential-types v1.0.0 (*)
    │   ├── aws-http v0.60.0
    │   │   ├── aws-smithy-runtime-api v1.0.1 (*)
    │   │   ├── aws-smithy-types v1.0.1 (*)
    │   │   ├── aws-types v1.0.0
    │   │   │   ├── aws-credential-types v1.0.0 (*)
    │   │   │   ├── aws-smithy-async v1.0.1 (*)
    │   │   │   ├── aws-smithy-runtime-api v1.0.1 (*)
    │   │   │   ├── aws-smithy-types v1.0.1 (*)
    │   ├── aws-sigv4 v1.0.0
    │   │   ├── aws-credential-types v1.0.0 (*)
    │   │   ├── aws-smithy-eventstream v0.60.0
    │   │   │   ├── aws-smithy-types v1.0.1 (*)
    │   │   ├── aws-smithy-http v0.60.0
    │   │   │   ├── aws-smithy-eventstream v0.60.0 (*)
    │   │   │   ├── aws-smithy-runtime-api v1.0.1 (*)
    │   │   │   ├── aws-smithy-types v1.0.1 (*)
    │   │   ├── aws-smithy-runtime-api v1.0.1 (*)
    │   │   ├── aws-smithy-types v1.0.1 (*)
    │   ├── aws-smithy-async v1.0.1 (*)
    │   ├── aws-smithy-eventstream v0.60.0 (*)
    │   ├── aws-smithy-http v0.60.0 (*)
    │   ├── aws-smithy-runtime-api v1.0.1 (*)
    │   ├── aws-smithy-types v1.0.1 (*)
    │   ├── aws-types v1.0.0 (*)
    ├── aws-sdk-s3 v0.39.1
    │   ├── aws-credential-types v1.0.0 (*)
    │   ├── aws-http v0.60.0 (*)
    │   ├── aws-runtime v1.0.0 (*)
    │   ├── aws-sigv4 v1.0.0 (*)
    │   ├── aws-smithy-async v1.0.1 (*)
    │   ├── aws-smithy-checksums v0.60.0
    │   │   ├── aws-smithy-http v0.60.0 (*)
    │   │   ├── aws-smithy-types v1.0.1 (*)
    │   ├── aws-smithy-eventstream v0.60.0 (*)
    │   ├── aws-smithy-http v0.60.0 (*)
    │   ├── aws-smithy-json v0.60.0
    │   │   └── aws-smithy-types v1.0.1 (*)
    │   ├── aws-smithy-runtime v1.0.1
    │   │   ├── aws-smithy-async v1.0.1 (*)
    │   │   ├── aws-smithy-http v0.60.0 (*)
    │   │   ├── aws-smithy-runtime-api v1.0.1 (*)
    │   │   ├── aws-smithy-types v1.0.1 (*)
    │   ├── aws-smithy-runtime-api v1.0.1 (*)
    │   ├── aws-smithy-types v1.0.1 (*)
    │   ├── aws-smithy-xml v0.60.0
    │   ├── aws-types v1.0.0 (*)
    ├── aws-sigv4 v1.0.0 (*)
    ├── aws-smithy-runtime v1.0.1 (*)
    ├── aws-smithy-types v1.0.1 (*)
│   ├── aws-config v1.0.0
│   │   ├── aws-credential-types v1.0.0 (*)
│   │   ├── aws-http v0.60.0 (*)
│   │   ├── aws-runtime v1.0.0 (*)
│   │   ├── aws-sdk-sts v0.39.0
│   │   │   ├── aws-credential-types v1.0.0 (*)
│   │   │   ├── aws-http v0.60.0 (*)
│   │   │   ├── aws-runtime v1.0.0 (*)
│   │   │   ├── aws-smithy-async v1.0.1 (*)
│   │   │   ├── aws-smithy-http v0.60.0 (*)
│   │   │   ├── aws-smithy-json v0.60.0 (*)
│   │   │   ├── aws-smithy-query v0.60.0
│   │   │   │   ├── aws-smithy-types v1.0.1 (*)
│   │   │   ├── aws-smithy-runtime v1.0.1 (*)
│   │   │   ├── aws-smithy-runtime-api v1.0.1 (*)
│   │   │   ├── aws-smithy-types v1.0.1 (*)
│   │   │   ├── aws-smithy-xml v0.60.0 (*)
│   │   │   ├── aws-types v1.0.0 (*)
│   │   ├── aws-smithy-async v1.0.1 (*)
│   │   ├── aws-smithy-http v0.60.0 (*)
│   │   ├── aws-smithy-json v0.60.0 (*)
│   │   ├── aws-smithy-runtime v1.0.1 (*)
│   │   ├── aws-smithy-runtime-api v1.0.1 (*)
│   │   ├── aws-smithy-types v1.0.1 (*)
│   │   ├── aws-types v1.0.0 (*)
│   ├── aws-smithy-http v0.60.0 (*)
│   ├── aws-smithy-runtime v1.0.1 (*)
│   ├── aws-smithy-runtime-api v1.0.1 (*)
│   ├── aws-smithy-types v1.0.1 (*)
│   ├── madsim-aws-sdk-s3 v0.4.0+0.39
│   │   └── aws-sdk-s3 v0.39.1 (*)
│   ├── aws-config v1.0.0 (*)
│   ├── aws-credential-types v1.0.0 (*)
│   ├── aws-sdk-kinesis v0.39.1
│   │   ├── aws-credential-types v1.0.0 (*)
│   │   ├── aws-http v0.60.0 (*)
│   │   ├── aws-runtime v1.0.0 (*)
│   │   ├── aws-smithy-async v1.0.1 (*)
│   │   ├── aws-smithy-http v0.60.0 (*)
│   │   ├── aws-smithy-json v0.60.0 (*)
│   │   ├── aws-smithy-runtime v1.0.1 (*)
│   │   ├── aws-smithy-runtime-api v1.0.1 (*)
│   │   ├── aws-smithy-types v1.0.1 (*)
│   │   ├── aws-types v1.0.0 (*)
│   ├── aws-sdk-s3 v0.39.1 (*)
│   ├── aws-smithy-http v0.60.0 (*)
│   ├── aws-smithy-runtime-api v1.0.1 (*)
│   ├── aws-smithy-types v1.0.1 (*)
│   ├── aws-types v1.0.0 (*)
├── aws-config v1.0.0 (*)
├── aws-sdk-s3 v0.39.1 (*)
├── aws-smithy-http v0.60.0 (*)
├── aws-smithy-types v1.0.1 (*)
│   │   │   │   ├── aws-config v1.0.0 (*)
│   │   │   │   ├── aws-sdk-ec2 v0.39.1
│   │   │   │   │   ├── aws-credential-types v1.0.0 (*)
│   │   │   │   │   ├── aws-http v0.60.0 (*)
│   │   │   │   │   ├── aws-runtime v1.0.0 (*)
│   │   │   │   │   ├── aws-smithy-async v1.0.1 (*)
│   │   │   │   │   ├── aws-smithy-http v0.60.0 (*)
│   │   │   │   │   ├── aws-smithy-json v0.60.0 (*)
│   │   │   │   │   ├── aws-smithy-query v0.60.0 (*)
│   │   │   │   │   ├── aws-smithy-runtime v1.0.1 (*)
│   │   │   │   │   ├── aws-smithy-runtime-api v1.0.1 (*)
│   │   │   │   │   ├── aws-smithy-types v1.0.1 (*)
│   │   │   │   │   ├── aws-smithy-xml v0.60.0 (*)
│   │   │   │   │   ├── aws-types v1.0.0 (*)
├── madsim-aws-sdk-s3 v0.4.0+0.39 (*)

Environment details (OS name and version, etc.)

Linux / Mac

Logs

No response

@MrCroxx MrCroxx added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 24, 2023
@ysaito1001
Copy link
Collaborator

Closing this as it's a duplicate of #973 (let us know if it's not).

Copy link

⚠️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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants