Skip to content

Crt profile credentials provider#3721

Open
pulimsr wants to merge 28 commits intomainfrom
crt-profile-credentials-provider
Open

Crt profile credentials provider#3721
pulimsr wants to merge 28 commits intomainfrom
crt-profile-credentials-provider

Conversation

@pulimsr
Copy link
Contributor

@pulimsr pulimsr commented Feb 12, 2026

Implementing the CRT's profile provider and removing the process provider from the default chain, also enabling the ProcessCredentials on ProfileCredentialsProvider

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Adding CRTProfileCredentialsProvider for CRT-based profile credential
merge branch 'main' of https://github.com/aws/aws-sdk-cpp into crt-profile-credentials-provider
…ider from the default chain, also enabling the ProcessCredentials on ProfileCredentialsProvider
* refreshRateMs as the frequency at which the file is reparsed in milliseconds. Defaults to 5 minutes.
*/
ProfileCredentialsProvider(const char* profile, long refreshRateMs = REFRESH_THRESHOLD);
ProfileCredentialsProvider(const char* profile);
Copy link
Contributor

Choose a reason for hiding this comment

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

cant remove this from the public facing interface -- thats a breakign change, it just wont be passed down the impl

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright

*/
static Aws::String GetProfileDirectory();

protected:
Copy link
Contributor

Choose a reason for hiding this comment

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

cant remove this from the interface thats a breaking change, you can have it but it must do nothing

ReaderLockGuard guard(m_reloadLock);
if (!IsTimeToRefresh(m_loadFrequencyMs)) {
return;
class ProfileCredentialsProvider::ProfileCredentialsProviderImp : public CrtCredentialsProvider {
Copy link
Contributor

Choose a reason for hiding this comment

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

public CrtCredentialsProvider

chefs kiss

:CrtCredentialsProvider(
[profile]()-> std::shared_ptr<ICredentialsProvider> {
CredentialsProviderProfileConfig config;
if (profile && profile[0] !='\0') {
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need this validation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removing it

CredentialsProviderProfileConfig config;
return CredentialsProvider::CreateCredentialsProviderProfile(config);
},
std::chrono::milliseconds(5000),
Copy link
Contributor

Choose a reason for hiding this comment

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

why 5 seconds?

@pulimsr pulimsr force-pushed the crt-profile-credentials-provider branch 2 times, most recently from 44b26f3 to 1be720c Compare February 13, 2026 13:35
@pulimsr pulimsr force-pushed the crt-profile-credentials-provider branch from 1be720c to a85bead Compare February 13, 2026 14:26
Copy link
Contributor

@sbiscigl sbiscigl left a comment

Choose a reason for hiding this comment

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

2 nit comments and one rant, looks really good!

#pragma once

#include <aws/core/Core_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: no actual change in file so lets from it from the PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

alright

ProfileCredentialsProvider::ProfileCredentialsProvider(long refreshRateMs)
: m_impl(std::make_shared<ProfileCredentialsProviderImp>(refreshRateMs)) {}
ProfileCredentialsProvider::ProfileCredentialsProvider(long refreshRateMs) : m_impl(std::make_shared<ProfileCredentialsProviderImp>()) {
(void)refreshRateMs;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit use the macro AWS_UNREFERENCED_PARAM instead of void cast because its more accurate

protected:
DefaultCredentialsProviderChainIntegrationTest()
{
m_options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Debug;
Copy link
Contributor

Choose a reason for hiding this comment

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

we really aught to make this a official construct, i write this code at least times a week. not here for this PR, but something we should about. might help people use the SDK correctly better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🫡

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