6
6
7
7
#include < aws/crt/Exports.h>
8
8
#include < aws/crt/Types.h>
9
+ #include < aws/crt/http/HttpConnection.h>
10
+ #include < aws/crt/io/TlsOptions.h>
9
11
10
12
#include < chrono>
11
13
#include < functional>
@@ -22,6 +24,11 @@ namespace Aws
22
24
class ClientBootstrap ;
23
25
}
24
26
27
+ namespace Http
28
+ {
29
+ class HttpClientConnectionProxyOptions ;
30
+ }
31
+
25
32
namespace Auth
26
33
{
27
34
/* *
@@ -228,6 +235,45 @@ namespace Aws
228
235
Io::ClientBootstrap *Bootstrap;
229
236
};
230
237
238
+ /* *
239
+ * Configuration options for the X509 credentials provider
240
+ */
241
+ struct AWS_CRT_CPP_API CredentialsProviderX509Config
242
+ {
243
+ CredentialsProviderX509Config ()
244
+ : Bootstrap(nullptr ), TlsOptions(), ThingName(), RoleAlias(), Endpoint(), ProxyOptions()
245
+ {
246
+ }
247
+
248
+ /* *
249
+ * Connection bootstrap to use to create the http connection required to
250
+ * query credentials from the x509 provider
251
+ */
252
+ Io::ClientBootstrap *Bootstrap;
253
+
254
+ /* TLS connection options that have been initialized with your x509 certificate and private key */
255
+ Io::TlsConnectionOptions TlsOptions;
256
+
257
+ /* IoT thing name you registered with AWS IOT for your device, it will be used in http request header */
258
+ String ThingName;
259
+
260
+ /* Iot role alias you created with AWS IoT for your IAM role, it will be used in http request path */
261
+ String RoleAlias;
262
+
263
+ /* *
264
+ * AWS account specific endpoint that can be acquired using AWS CLI following instructions from the demo
265
+ * example: c2sakl5huz0afv.credentials.iot.us-east-1.amazonaws.com
266
+ *
267
+ * This a different endpoint than the IoT data mqtt broker endpoint.
268
+ */
269
+ String Endpoint;
270
+
271
+ /* *
272
+ * (Optional) Http proxy configuration for the http request that fetches credentials
273
+ */
274
+ Optional<Http::HttpClientConnectionProxyOptions> ProxyOptions;
275
+ };
276
+
231
277
/* *
232
278
* Simple credentials provider implementation that wraps one of the internal C-based implementations.
233
279
*
@@ -313,13 +359,21 @@ namespace Aws
313
359
/* *
314
360
* Creates the SDK-standard default credentials provider which is a cache-fronted chain of:
315
361
*
316
- * Environment -> Profile -> IMDS
362
+ * Environment -> Profile -> IMDS/ECS
317
363
*
318
364
*/
319
365
static std::shared_ptr<ICredentialsProvider> CreateCredentialsProviderChainDefault (
320
366
const CredentialsProviderChainDefaultConfig &config,
321
367
Allocator *allocator = g_allocator);
322
368
369
+ /* *
370
+ * Creates a provider that sources credentials from the IoT X509 provider service
371
+ *
372
+ */
373
+ static std::shared_ptr<ICredentialsProvider> CreateCredentialsProviderX509 (
374
+ const CredentialsProviderX509Config &config,
375
+ Allocator *allocator = g_allocator);
376
+
323
377
private:
324
378
static void s_onCredentialsResolved (aws_credentials *credentials, int error_code, void *user_data);
325
379
@@ -328,4 +382,4 @@ namespace Aws
328
382
};
329
383
} // namespace Auth
330
384
} // namespace Crt
331
- } // namespace Aws
385
+ } // namespace Aws
0 commit comments