Skip to content

Commit 595866d

Browse files
committed
switch implementation to use return value
1 parent 0180ca7 commit 595866d

File tree

22 files changed

+99
-316
lines changed

22 files changed

+99
-316
lines changed

generated/src/aws-cpp-sdk-s3-crt/include/aws/s3-crt/S3ExpressIdentityProvider.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <aws/core/utils/memory/stl/AWSString.h>
1010
#include <aws/core/utils/ConcurrentCache.h>
1111
#include <aws/core/auth/signer/AWSAuthSignerBase.h>
12-
#include <aws/core/auth/AWSCredentialsProvider.h>
1312
#include <aws/s3-crt/S3ExpressIdentity.h>
1413
#include <smithy/identity/resolver/AwsIdentityResolverBase.h>
1514
#include <thread>
@@ -29,12 +28,6 @@ namespace Aws {
2928
virtual S3ExpressIdentity
3029
GetS3ExpressIdentity(const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) = 0;
3130

32-
virtual S3ExpressIdentity
33-
GetS3ExpressIdentity(Aws::Auth::CredentialsResolutionContext& context, const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) {
34-
AWS_UNREFERENCED_PARAM(context);
35-
return GetS3ExpressIdentity(serviceSpecificParameters);
36-
}
37-
3831
ResolveIdentityFutureOutcome
3932
getIdentity(const IdentityProperties& identityProperties, const AdditionalParameters& additionalParameters) override;
4033
S3ExpressIdentity
@@ -67,8 +60,6 @@ namespace Aws {
6760

6861
S3ExpressIdentity GetS3ExpressIdentity(const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) override;
6962

70-
S3ExpressIdentity GetS3ExpressIdentity(Aws::Auth::CredentialsResolutionContext& context, const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) override;
71-
7263
private:
7364
mutable std::shared_ptr<Aws::Utils::ConcurrentCache<Aws::String, S3ExpressIdentity>> m_credentialsCache;
7465
};
@@ -91,8 +82,6 @@ namespace Aws {
9182

9283
S3ExpressIdentity GetS3ExpressIdentity(const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) override;
9384

94-
S3ExpressIdentity GetS3ExpressIdentity(Aws::Auth::CredentialsResolutionContext& context, const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) override;
95-
9685
private:
9786
void refreshIdentities(std::chrono::minutes refreshPeriod);
9887
void threadSafeKeyInsert(const Aws::String& key);

generated/src/aws-cpp-sdk-s3-crt/include/aws/s3-crt/S3ExpressSigner.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ namespace Aws {
4343

4444
Aws::Auth::AWSCredentials GetCredentials(const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) const override;
4545

46-
Aws::Auth::AWSCredentials GetCredentials(Aws::Auth::CredentialsResolutionContext& context, const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) const override;
47-
4846
protected:
4947
bool ServiceRequireUnsignedPayload(const String &serviceName) const override;
5048

generated/src/aws-cpp-sdk-s3-crt/source/S3ExpressIdentityProvider.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,6 @@ S3ExpressIdentity DefaultS3ExpressIdentityProvider::GetS3ExpressIdentity(const s
115115
return identity;
116116
}
117117

118-
S3ExpressIdentity DefaultS3ExpressIdentityProvider::GetS3ExpressIdentity(Aws::Auth::CredentialsResolutionContext& context, const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) {
119-
AWS_UNREFERENCED_PARAM(context);
120-
return GetS3ExpressIdentity(serviceSpecificParameters);
121-
}
122-
123118
Aws::S3Crt::DefaultAsyncS3ExpressIdentityProvider::DefaultAsyncS3ExpressIdentityProvider(
124119
const S3CrtClient &s3Client,
125120
std::chrono::minutes refreshPeriod) :
@@ -197,11 +192,6 @@ S3ExpressIdentity DefaultAsyncS3ExpressIdentityProvider::GetS3ExpressIdentity(co
197192
return identity;
198193
}
199194

200-
S3ExpressIdentity DefaultAsyncS3ExpressIdentityProvider::GetS3ExpressIdentity(Aws::Auth::CredentialsResolutionContext& context, const std::shared_ptr<ServiceSpecificParameters> &serviceSpecificParameters) {
201-
AWS_UNREFERENCED_PARAM(context);
202-
return GetS3ExpressIdentity(serviceSpecificParameters);
203-
}
204-
205195
void DefaultAsyncS3ExpressIdentityProvider::threadSafeKeyEmpty() {
206196
std::lock_guard<std::mutex> lock(m_keysUsedMutex);
207197
m_keysUsed.clear();

generated/src/aws-cpp-sdk-s3-crt/source/S3ExpressSigner.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,3 @@ Aws::Auth::AWSCredentials S3ExpressSigner::GetCredentials(const std::shared_ptr<
9595
auto identity = m_S3ExpressIdentityProvider->GetS3ExpressIdentity(serviceSpecificParameters);
9696
return {identity.getAccessKeyId(), identity.getSecretKeyId()};
9797
}
98-
99-
Aws::Auth::AWSCredentials S3ExpressSigner::GetCredentials(Aws::Auth::CredentialsResolutionContext& context, const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) const {
100-
auto identity = m_S3ExpressIdentityProvider->GetS3ExpressIdentity(context, serviceSpecificParameters);
101-
return {identity.getAccessKeyId(), identity.getSecretKeyId()};
102-
}

generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressIdentityProvider.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include <aws/core/utils/memory/stl/AWSString.h>
1010
#include <aws/core/utils/ConcurrentCache.h>
1111
#include <aws/core/auth/signer/AWSAuthSignerBase.h>
12-
#include <aws/core/auth/AWSCredentialsProvider.h>
1312
#include <aws/s3/S3ExpressIdentity.h>
1413
#include <smithy/identity/resolver/AwsIdentityResolverBase.h>
1514
#include <thread>
@@ -29,12 +28,6 @@ namespace Aws {
2928
virtual S3ExpressIdentity
3029
GetS3ExpressIdentity(const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) = 0;
3130

32-
virtual S3ExpressIdentity
33-
GetS3ExpressIdentity(Aws::Auth::CredentialsResolutionContext& context, const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) {
34-
AWS_UNREFERENCED_PARAM(context);
35-
return GetS3ExpressIdentity(serviceSpecificParameters);
36-
}
37-
3831
ResolveIdentityFutureOutcome
3932
getIdentity(const IdentityProperties& identityProperties, const AdditionalParameters& additionalParameters) override;
4033
S3ExpressIdentity
@@ -67,8 +60,6 @@ namespace Aws {
6760

6861
S3ExpressIdentity GetS3ExpressIdentity(const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) override;
6962

70-
S3ExpressIdentity GetS3ExpressIdentity(Aws::Auth::CredentialsResolutionContext& context, const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) override;
71-
7263
private:
7364
mutable std::shared_ptr<Aws::Utils::ConcurrentCache<Aws::String, S3ExpressIdentity>> m_credentialsCache;
7465
};
@@ -91,8 +82,6 @@ namespace Aws {
9182

9283
S3ExpressIdentity GetS3ExpressIdentity(const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) override;
9384

94-
S3ExpressIdentity GetS3ExpressIdentity(Aws::Auth::CredentialsResolutionContext& context, const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) override;
95-
9685
private:
9786
void refreshIdentities(std::chrono::minutes refreshPeriod);
9887
void threadSafeKeyInsert(const Aws::String& key);

generated/src/aws-cpp-sdk-s3/include/aws/s3/S3ExpressSigner.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ namespace Aws {
4343

4444
Aws::Auth::AWSCredentials GetCredentials(const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) const override;
4545

46-
Aws::Auth::AWSCredentials GetCredentials(Aws::Auth::CredentialsResolutionContext& context, const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) const override;
47-
4846
protected:
4947
bool ServiceRequireUnsignedPayload(const String &serviceName) const override;
5048

generated/src/aws-cpp-sdk-s3/source/S3ExpressIdentityProvider.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,6 @@ S3ExpressIdentity DefaultS3ExpressIdentityProvider::GetS3ExpressIdentity(const s
115115
return identity;
116116
}
117117

118-
S3ExpressIdentity DefaultS3ExpressIdentityProvider::GetS3ExpressIdentity(Aws::Auth::CredentialsResolutionContext& context, const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) {
119-
AWS_UNREFERENCED_PARAM(context);
120-
return GetS3ExpressIdentity(serviceSpecificParameters);
121-
}
122-
123118
Aws::S3::DefaultAsyncS3ExpressIdentityProvider::DefaultAsyncS3ExpressIdentityProvider(
124119
const S3Client &s3Client,
125120
std::chrono::minutes refreshPeriod) :
@@ -197,11 +192,6 @@ S3ExpressIdentity DefaultAsyncS3ExpressIdentityProvider::GetS3ExpressIdentity(co
197192
return identity;
198193
}
199194

200-
S3ExpressIdentity DefaultAsyncS3ExpressIdentityProvider::GetS3ExpressIdentity(Aws::Auth::CredentialsResolutionContext& context, const std::shared_ptr<ServiceSpecificParameters> &serviceSpecificParameters) {
201-
AWS_UNREFERENCED_PARAM(context);
202-
return GetS3ExpressIdentity(serviceSpecificParameters);
203-
}
204-
205195
void DefaultAsyncS3ExpressIdentityProvider::threadSafeKeyEmpty() {
206196
std::lock_guard<std::mutex> lock(m_keysUsedMutex);
207197
m_keysUsed.clear();

generated/src/aws-cpp-sdk-s3/source/S3ExpressSigner.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,3 @@ Aws::Auth::AWSCredentials S3ExpressSigner::GetCredentials(const std::shared_ptr<
9595
auto identity = m_S3ExpressIdentityProvider->GetS3ExpressIdentity(serviceSpecificParameters);
9696
return {identity.getAccessKeyId(), identity.getSecretKeyId()};
9797
}
98-
99-
Aws::Auth::AWSCredentials S3ExpressSigner::GetCredentials(Aws::Auth::CredentialsResolutionContext& context, const std::shared_ptr<Aws::Http::ServiceSpecificParameters> &serviceSpecificParameters) const {
100-
auto identity = m_S3ExpressIdentityProvider->GetS3ExpressIdentity(context, serviceSpecificParameters);
101-
return {identity.getAccessKeyId(), identity.getSecretKeyId()};
102-
}

src/aws-cpp-sdk-core/include/aws/core/auth/AWSCredentials.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,42 @@
66
#pragma once
77

88
#include <aws/core/Core_EXPORTS.h>
9+
#include <aws/core/client/UserAgent.h>
910
#include <aws/core/utils/memory/stl/AWSString.h>
1011
#include <aws/core/utils/DateTime.h>
1112
namespace Aws
1213
{
1314
namespace Auth
1415
{
16+
/**
17+
* Context class for credential resolution that tracks features used during credential retrieval.
18+
*/
19+
class AWS_CORE_API CredentialsResolutionContext
20+
{
21+
public:
22+
// Default constructor - no features tracked
23+
CredentialsResolutionContext() = default;
24+
25+
/**
26+
* Add a user agent feature to track credential usage.
27+
*/
28+
void AddUserAgentFeature(Aws::Client::UserAgentFeature feature)
29+
{
30+
m_features.insert(feature);
31+
}
32+
33+
/**
34+
* Get all tracked credential features.
35+
*/
36+
const Aws::Set<Aws::Client::UserAgentFeature> GetUserAgentFeatures() const
37+
{
38+
return m_features;
39+
}
40+
41+
private:
42+
Aws::Set<Aws::Client::UserAgentFeature> m_features;
43+
};
44+
1545
/**
1646
* Simple data object around aws credentials
1747
*/
@@ -214,12 +244,24 @@ namespace Aws
214244
m_expiration = expiration;
215245
}
216246

247+
/**
248+
* Gets credential resolution context. this is information about the call
249+
* such as what credentials provider was used to to resolve the credentials
250+
*/
251+
inline CredentialsResolutionContext GetContext() { return m_context; }
252+
253+
/**
254+
* Adds a user agent feature used during credentials resolution to the credentials
255+
* context. This is useful to track which credentials provider was used.
256+
*/
257+
inline void AddUserAgentFeatire(Aws::Client::UserAgentFeature feature) { m_context.AddUserAgentFeature(feature); }
217258
private:
218259
Aws::String m_accessKeyId;
219260
Aws::String m_secretKey;
220261
Aws::String m_sessionToken;
221262
Aws::Utils::DateTime m_expiration;
222263
Aws::String m_accountId;
264+
CredentialsResolutionContext m_context;
223265
};
224266
}
225267
}

src/aws-cpp-sdk-core/include/aws/core/auth/AWSCredentialsProvider.h

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#include <aws/core/auth/AWSCredentials.h>
1919
#include <aws/core/config/AWSProfileConfigLoader.h>
2020
#include <aws/core/client/RetryStrategy.h>
21-
#include <aws/core/client/UserAgent.h>
22-
#include <aws/core/utils/memory/stl/AWSSet.h>
2321
#include <memory>
2422

2523
namespace Aws
@@ -30,34 +28,6 @@ namespace Aws
3028
}
3129
namespace Auth
3230
{
33-
/**
34-
* Context class for credential resolution that tracks features used during credential retrieval.
35-
*/
36-
class AWS_CORE_API CredentialsResolutionContext
37-
{
38-
public:
39-
// Default constructor - no features tracked
40-
CredentialsResolutionContext() = default;
41-
42-
/**
43-
* Add a user agent feature to track credential usage.
44-
*/
45-
void AddUserAgentFeature(Aws::Client::UserAgentFeature feature)
46-
{
47-
m_features.insert(feature);
48-
}
49-
50-
/**
51-
* Get all tracked credential features.
52-
*/
53-
const Aws::Set<Aws::Client::UserAgentFeature>& GetUserAgentFeatures() const
54-
{
55-
return m_features;
56-
}
57-
58-
private:
59-
Aws::Set<Aws::Client::UserAgentFeature> m_features;
60-
};
6131
constexpr int REFRESH_THRESHOLD = 1000 * 60 * 5;
6232

6333
constexpr int AWS_CREDENTIAL_PROVIDER_EXPIRATION_GRACE_PERIOD = 5 * 1000;
@@ -103,14 +73,6 @@ namespace Aws
10373
*/
10474
virtual AWSCredentials GetAWSCredentials() = 0;
10575

106-
/**
107-
* Interface that allows providers to populate context during credential retrieval.
108-
*/
109-
virtual AWSCredentials GetAWSCredentials(CredentialsResolutionContext& context) {
110-
AWS_UNREFERENCED_PARAM(context);
111-
return GetAWSCredentials();
112-
}
113-
11476
protected:
11577
/**
11678
* The default implementation keeps up with the cache times and lets you know if it's time to refresh your internal caching
@@ -182,11 +144,6 @@ namespace Aws
182144
* are not found, empty credentials are returned. Credentials are not cached.
183145
*/
184146
AWSCredentials GetAWSCredentials() override;
185-
186-
/**
187-
* Context-based interface that adds environment credential tracking.
188-
*/
189-
AWSCredentials GetAWSCredentials(CredentialsResolutionContext& context) override;
190147
};
191148

192149
/**

0 commit comments

Comments
 (0)