Skip to content

Commit a1ee69e

Browse files
committed
updated to only HTTPS Client
1 parent 987f97f commit a1ee69e

File tree

6 files changed

+1
-311
lines changed

6 files changed

+1
-311
lines changed

src/aws-cpp-sdk-core/include/aws/core/client/UserAgent.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,10 @@ enum class UserAgentFeature {
3434
GZIP_REQUEST_COMPRESSION,
3535
CREDENTIALS_ENV_VARS,
3636
CREDENTIALS_PROFILE,
37-
CREDENTIALS_PROCESS,
3837
CREDENTIALS_PROFILE_PROCESS,
3938
CREDENTIALS_IMDS,
4039
CREDENTIALS_STS_ASSUME_ROLE,
4140
CREDENTIALS_HTTP,
42-
CREDENTIALS_SSO,
4341
};
4442

4543
class AWS_CORE_API UserAgent {

src/aws-cpp-sdk-core/source/auth/AWSCredentialsProvider.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,6 @@ AWSCredentials Aws::Auth::GetCredentialsFromProcess(const Aws::String& process)
446446
credentials.SetAccountId(credentialsView.GetString("AccountId"));
447447
}
448448

449-
if (!credentials.IsEmpty()) {
450-
credentials.AddUserAgentFeature(UserAgentFeature::CREDENTIALS_PROCESS);
451-
}
452-
453449
AWS_LOGSTREAM_DEBUG(PROFILE_LOG_TAG, "Successfully pulled credentials from process credential with AccessKey: " << accessKey << ", Expiration:" << credentialsView.GetString("Expiration"));
454450
return credentials;
455451
}

src/aws-cpp-sdk-core/source/auth/SSOCredentialsProvider.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ void SSOCredentialsProvider::Reload()
101101
AWS_LOGSTREAM_TRACE(SSO_CREDENTIALS_PROVIDER_LOG_TAG, "Successfully retrieved credentials with AWS_ACCESS_KEY: " << result.creds.GetAWSAccessKeyId());
102102

103103
m_credentials = result.creds;
104-
if (!m_credentials.IsEmpty()) {
105-
m_credentials.AddUserAgentFeature(Aws::Client::UserAgentFeature::CREDENTIALS_SSO);
106-
}
107104
}
108105

109106
void SSOCredentialsProvider::RefreshIfExpired()

src/aws-cpp-sdk-core/source/client/UserAgent.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,10 @@ const std::pair<UserAgentFeature, const char*> BUSINESS_METRIC_MAPPING[] = {
4444
{UserAgentFeature::GZIP_REQUEST_COMPRESSION, "L"},
4545
{UserAgentFeature::CREDENTIALS_ENV_VARS, "g"},
4646
{UserAgentFeature::CREDENTIALS_PROFILE, "n"},
47-
{UserAgentFeature::CREDENTIALS_PROCESS, "w"},
4847
{UserAgentFeature::CREDENTIALS_PROFILE_PROCESS, "v"},
4948
{UserAgentFeature::CREDENTIALS_IMDS, "0"},
5049
{UserAgentFeature::CREDENTIALS_STS_ASSUME_ROLE, "i"},
5150
{UserAgentFeature::CREDENTIALS_HTTP, "z"},
52-
{UserAgentFeature::CREDENTIALS_SSO, "s"},
5351
};
5452

5553
const std::pair<const char*, UserAgentFeature> RETRY_FEATURE_MAPPING[] = {

tests/aws-cpp-sdk-core-tests/aws/auth/CredentialTrackingTest.cpp

Lines changed: 1 addition & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include <aws/testing/platform/PlatformTesting.h>
1212
#include <aws/core/auth/AWSCredentialsProvider.h>
1313
#include <aws/core/auth/AWSCredentialsProviderChain.h>
14-
#include <aws/core/auth/SSOCredentialsProvider.h>
1514
#include <aws/core/auth/GeneralHTTPCredentialsProvider.h>
1615
#include <aws/core/client/AWSClient.h>
1716
#include <aws/core/utils/StringUtils.h>
@@ -20,12 +19,10 @@
2019
#include <aws/core/utils/FileSystemUtils.h>
2120
#include <fstream>
2221
#include <sys/stat.h>
23-
#include <thread>
2422

2523
using namespace Aws::Client;
2624
using namespace Aws::Auth;
2725
using namespace Aws::Http;
28-
using namespace Aws::FileSystem;
2926
using namespace Aws::Http::Standard;
3027

3128
namespace {
@@ -105,26 +102,6 @@ class CredentialTrackingTest : public Aws::Testing::AwsCppSdkGTestSuite
105102
Aws::Http::InitHttp();
106103
}
107104

108-
void SaveEnvironmentVariable(const char* variableName)
109-
{
110-
m_environment.emplace_back(variableName, Aws::Environment::GetEnv(variableName));
111-
}
112-
113-
void RestoreEnvironmentVariables()
114-
{
115-
for(const auto& iter : m_environment)
116-
{
117-
if(iter.second.empty())
118-
{
119-
Aws::Environment::UnSetEnv(iter.first);
120-
}
121-
else
122-
{
123-
Aws::Environment::SetEnv(iter.first, iter.second.c_str(), 1);
124-
}
125-
}
126-
}
127-
128105
void RunTestWithCredentialsProvider(const std::shared_ptr<AWSCredentialsProvider>& credentialsProvider, const Aws::String& id) {
129106
// Setup mock response
130107
std::shared_ptr<HttpRequest> requestTmp =
@@ -265,72 +242,4 @@ TEST_F(CredentialTrackingTest, TestHTTPCredentialsTracking)
265242
auto credsProvider = Aws::MakeShared<Aws::Auth::GeneralHTTPCredentialsProvider>(TEST_LOG_TAG,
266243
"", "http://127.0.0.1/credentials", "", "");
267244
RunTestWithCredentialsProvider(std::move(credsProvider), "z");
268-
}
269-
270-
// TEST_F(CredentialTrackingTest, TestSSOCredentialsTracking)
271-
// {
272-
// // Create temporary config file with SSO configuration
273-
// Aws::Utils::TempFile configFile(std::ios_base::out | std::ios_base::trunc);
274-
// ASSERT_TRUE(configFile.good());
275-
// configFile << "[default]" << std::endl
276-
// << "sso_account_id = [REDACTED:BANK_ACCOUNT_NUMBER]" << std::endl
277-
// << "sso_region = us-east-1" << std::endl
278-
// << "sso_role_name = TestRole" << std::endl
279-
// << "sso_start_url = https://d-test.awsapps.com/start" << std::endl;
280-
// configFile.close();
281-
//
282-
// // Create SSO token cache directory and file
283-
// Aws::String cacheDir = "/tmp/.aws/sso/cache";
284-
// Aws::FileSystem::CreateDirectoryIfNotExists("/tmp/.aws");
285-
// Aws::FileSystem::CreateDirectoryIfNotExists(("/tmp/.aws/sso"));
286-
// Aws::FileSystem::CreateDirectoryIfNotExists(cacheDir.c_str());
287-
//
288-
// // Calculate token filename using SHA1 hash of start URL
289-
// Aws::String startUrl = "https://d-test.awsapps.com/start";
290-
// Aws::String hashedStartUrl = Aws::Utils::HashingUtils::HexEncode(
291-
// Aws::Utils::HashingUtils::CalculateSHA1(startUrl));
292-
// Aws::String tokenPath = cacheDir + "/" + hashedStartUrl + ".json";
293-
//
294-
// // Create SSO token cache file with future expiration
295-
// Aws::OFStream tokenFile(tokenPath.c_str());
296-
// ASSERT_TRUE(tokenFile.is_open());
297-
// tokenFile << R"({
298-
// "accessToken": "test-sso-token",
299-
// "expiresAt": "2037-04-19T00:00:00Z",
300-
// "region": "us-east-1",
301-
// "startUrl": "https://d-test.awsapps.com/start"
302-
// })";
303-
// tokenFile.close();
304-
//
305-
// // Set up mock response for SSO GetRoleCredentials
306-
// std::shared_ptr<HttpRequest> requestTmp =
307-
// CreateHttpRequest(Aws::Http::URI("https://portal.sso.us-east-1.amazonaws.com"),
308-
// Aws::Http::HttpMethod::HTTP_POST,
309-
// Aws::Utils::Stream::DefaultResponseStreamFactoryMethod);
310-
// auto successResponse = Aws::MakeShared<Standard::StandardHttpResponse>(TEST_LOG_TAG, requestTmp);
311-
// successResponse->SetResponseCode(HttpResponseCode::OK);
312-
// successResponse->GetResponseBody() << R"({
313-
// "roleCredentials": {
314-
// "accessKeyId": "test-sso-access-key",
315-
// "secretAccessKey": "test-sso-secret-key",
316-
// "sessionToken": "test-sso-session-token",
317-
// "expiration": 1767225600000
318-
// }
319-
// })";
320-
// mockHttpClient->AddResponseToReturn(successResponse);
321-
//
322-
// // Set environment to use our test config file
323-
// Aws::Environment::EnvironmentRAII testEnvironment{{
324-
// {"AWS_CONFIG_FILE", configFile.GetFileName().c_str()},
325-
// }};
326-
//
327-
// // Force reload config file after setting environment variable
328-
// Aws::Config::ReloadCachedConfigFile();
329-
//
330-
// // Create SSO credentials provider
331-
// auto ssoProvider = Aws::MakeShared<SSOCredentialsProvider>(TEST_LOG_TAG);
332-
// RunTestWithCredentialsProvider(std::move(ssoProvider), "s");
333-
//
334-
// // Cleanup
335-
// Aws::FileSystem::RemoveFileIfExists(tokenPath.c_str());
336-
// }
245+
}

tests/aws-cpp-sdk-core-tests/aws/auth/SSOCredentialTrackingTest.cpp

Lines changed: 0 additions & 208 deletions
This file was deleted.

0 commit comments

Comments
 (0)