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

fix s3 copy constructor #2798

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions generated/src/aws-cpp-sdk-s3-crt/source/S3CrtClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ const char* S3CrtClient::ALLOCATION_TAG = "S3CrtClient";
S3CrtClient::S3CrtClient(const S3CrtClient &rhs) :
BASECLASS(rhs.m_clientConfiguration,
Aws::MakeShared<Aws::Auth::S3ExpressSignerProvider>(ALLOCATION_TAG,
Aws::MakeShared<DefaultAWSCredentialsProviderChain>(ALLOCATION_TAG),
Aws::MakeShared<DefaultS3ExpressIdentityProvider>(ALLOCATION_TAG, *this),
rhs.GetCredentialsProvider(),
rhs.m_clientConfiguration.identityProviderSupplier(*this),
SERVICE_NAME,
Aws::Region::ComputeSignerRegion(rhs.m_clientConfiguration.region),
rhs.m_clientConfiguration.payloadSigningPolicy,
Expand Down
2 changes: 1 addition & 1 deletion generated/src/aws-cpp-sdk-s3/source/S3Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const char* S3Client::ALLOCATION_TAG = "S3Client";
S3Client::S3Client(const S3Client &rhs) :
BASECLASS(rhs.m_clientConfiguration,
Aws::MakeShared<Aws::Auth::S3ExpressSignerProvider>(ALLOCATION_TAG,
Aws::MakeShared<DefaultAWSCredentialsProviderChain>(ALLOCATION_TAG),
rhs.GetCredentialsProvider(),
rhs.m_clientConfiguration.identityProviderSupplier(*this),
SERVICE_NAME,
Aws::Region::ComputeSignerRegion(rhs.m_clientConfiguration.region),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ namespace Aws
namespace Auth
{
class AWSCredentialsProvider;
class DefaultAWSCredentialsProviderChain;

class AWS_CORE_API AWSAuthSignerProvider
{
public:
virtual std::shared_ptr<Aws::Client::AWSAuthSigner> GetSigner(const Aws::String& signerName) const = 0;
virtual void AddSigner(std::shared_ptr<Aws::Client::AWSAuthSigner>& signer) = 0;
virtual std::shared_ptr<AWSCredentialsProvider> GetCredentialsProvider() const;
virtual ~AWSAuthSignerProvider() = default;
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ namespace Aws
explicit DefaultAuthSignerProvider(const std::shared_ptr<Aws::Client::AWSAuthSigner>& signer);
void AddSigner(std::shared_ptr<Aws::Client::AWSAuthSigner>& signer) override;
std::shared_ptr<Aws::Client::AWSAuthSigner> GetSigner(const Aws::String& signerName) const override;
std::shared_ptr<AWSCredentialsProvider> GetCredentialsProvider() const override { return m_credentialsProvider; }
protected:
Aws::Vector<std::shared_ptr<Aws::Client::AWSAuthSigner>> m_signers;
std::shared_ptr<AWSCredentialsProvider> m_credentialsProvider;
};
}
}
4 changes: 4 additions & 0 deletions src/aws-cpp-sdk-core/include/aws/core/client/AWSClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ namespace Aws
Aws::Client::AWSAuthSigner* GetSignerByName(const char* name) const;

friend Aws::Client::AWSAuthSigner* AWSUrlPresigner::GetSignerByName(const char* name) const;

std::shared_ptr<Auth::AWSCredentialsProvider> GetCredentialsProvider() const {
return m_signerProvider->GetCredentialsProvider();
}
protected:

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/core/auth/signer-provider/AWSAuthSignerProviderBase.h>
#include <aws/core/auth/AWSCredentialsProviderChain.h>

using namespace Aws::Auth;

std::shared_ptr<AWSCredentialsProvider> AWSAuthSignerProvider::GetCredentialsProvider() const {
return MakeShared<DefaultAWSCredentialsProviderChain>("AWSAuthSignerProvider");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In a perfect world i would want to make the function pure virutal, but for backwards compat we can return the default credential provider.

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ const char CLASS_TAG[] = "AuthSignerProvider";
using namespace Aws::Auth;

DefaultAuthSignerProvider::DefaultAuthSignerProvider(const std::shared_ptr<AWSCredentialsProvider>& credentialsProvider,
const Aws::String& serviceName, const Aws::String& region, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy signingPolicy, bool urlEscapePath)
const Aws::String& serviceName,
const Aws::String& region,
Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy signingPolicy,
bool urlEscapePath):
m_credentialsProvider(credentialsProvider)
{
m_signers.emplace_back(Aws::MakeShared<Aws::Client::AWSAuthV4Signer>(CLASS_TAG, credentialsProvider, serviceName.c_str(), region, signingPolicy, urlEscapePath, AWSSigningAlgorithm::SIGV4));
m_signers.emplace_back(Aws::MakeShared<Aws::Client::AWSAuthV4Signer>(CLASS_TAG, credentialsProvider, serviceName.c_str(), region, signingPolicy, urlEscapePath, AWSSigningAlgorithm::ASYMMETRIC_SIGV4));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
${className}::${className}(const ${className} &rhs) :
BASECLASS(rhs.m_clientConfiguration,
Aws::MakeShared<${signerToMake}>(ALLOCATION_TAG,
${defaultCredentialsProviderChainParam},
rhs.GetCredentialsProvider(),
rhs.m_clientConfiguration.identityProviderSupplier(*this),
SERVICE_NAME,
Aws::Region::ComputeSignerRegion(rhs.m_clientConfiguration.region),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
${className}::${className}(const ${className} &rhs) :
BASECLASS(rhs.m_clientConfiguration,
Aws::MakeShared<Aws::Auth::S3ExpressSignerProvider>(ALLOCATION_TAG,
Aws::MakeShared<DefaultAWSCredentialsProviderChain>(ALLOCATION_TAG),
Aws::MakeShared<DefaultS3ExpressIdentityProvider>(ALLOCATION_TAG, *this),
rhs.GetCredentialsProvider(),
rhs.m_clientConfiguration.identityProviderSupplier(*this),
SERVICE_NAME,
Aws::Region::ComputeSignerRegion(rhs.m_clientConfiguration.region),
rhs.m_clientConfiguration.payloadSigningPolicy,
Expand Down
Loading