@@ -52,8 +52,47 @@ namespace Aws
52
52
*/
53
53
STSProfileCredentialsProvider (const Aws::String& profileName, std::chrono::minutes duration = std::chrono::minutes(60 ));
54
54
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
+ */
55
71
STSProfileCredentialsProvider (const Aws::String& profileName, std::chrono::minutes duration, const std::function<Aws::STS::STSClient*(const AWSCredentials&)> &stsClientFactory);
56
72
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
+
57
96
/* *
58
97
* Fetches the credentials set from STS following the rules defined in the shared configuration file.
59
98
*/
@@ -74,7 +113,7 @@ namespace Aws
74
113
AWSCredentials m_credentials;
75
114
const std::chrono::minutes m_duration;
76
115
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;
78
117
};
79
118
}
80
119
}
0 commit comments