@@ -52,8 +52,47 @@ namespace Aws
5252 */
5353 STSProfileCredentialsProvider (const Aws::String& profileName, std::chrono::minutes duration = std::chrono::minutes(60 ));
5454
55+ /* *
56+ * Use the provided profile name from the shared configuration file and a custom STS client.
57+ *
58+ * @param profileName The name of the profile in the shared configuration file.
59+ * @param duration The duration, in minutes, of the role session, after which the credentials are expired.
60+ * The value can range from 15 minutes up to the maximum session duration setting for the role. By default,
61+ * the duration is set to 1 hour.
62+ * Note: This credential provider refreshes the credentials 5 minutes before their expiration time. That
63+ * ensures the credentials do not expire between the time they're checked and the time they're returned to
64+ * the user.
65+ * If the duration for the credentials is 5 minutes or less, the provider will refresh the credentials only
66+ * when they expire.
67+ * @param stsClientFactory A factory function that creates an STSClient with specific credentials.
68+ * Using the overload where the function returns a shared_ptr is preferred.
69+ *
70+ */
5571 STSProfileCredentialsProvider (const Aws::String& profileName, std::chrono::minutes duration, const std::function<Aws::STS::STSClient*(const AWSCredentials&)> &stsClientFactory);
5672
73+ /* *
74+ * Use the provided profile name from the shared configuration file and a custom STS client.
75+ *
76+ * @param profileName The name of the profile in the shared configuration file.
77+ * @param duration The duration, in minutes, of the role session, after which the credentials are expired.
78+ * The value can range from 15 minutes up to the maximum session duration setting for the role. By default,
79+ * the duration is set to 1 hour.
80+ * Note: This credential provider refreshes the credentials 5 minutes before their expiration time. That
81+ * ensures the credentials do not expire between the time they're checked and the time they're returned to
82+ * the user.
83+ * If the duration for the credentials is 5 minutes or less, the provider will refresh the credentials only
84+ * when they expire.
85+ * @param stsClientFactory A factory function that creates an STSClient with specific credentials.
86+ *
87+ */
88+ STSProfileCredentialsProvider (const Aws::String& profileName, std::chrono::minutes duration, const std::function<std::shared_ptr<Aws::STS::STSClient>(const AWSCredentials&)> &stsClientFactory);
89+
90+ /* *
91+ * Compatibility constructor to assist with overload resolution when passing nullptr for the client factory.
92+ *
93+ */
94+ STSProfileCredentialsProvider (const Aws::String& profileName, std::chrono::minutes duration, std::nullptr_t );
95+
5796 /* *
5897 * Fetches the credentials set from STS following the rules defined in the shared configuration file.
5998 */
@@ -74,7 +113,7 @@ namespace Aws
74113 AWSCredentials m_credentials;
75114 const std::chrono::minutes m_duration;
76115 const std::chrono::milliseconds m_reloadFrequency;
77- std::function<Aws::STS::STSClient* (const AWSCredentials&)> m_stsClientFactory;
116+ std::function<std::shared_ptr< Aws::STS::STSClient> (const AWSCredentials&)> m_stsClientFactory;
78117 };
79118 }
80119}
0 commit comments