Skip to content

Commit 6eee7ec

Browse files
authored
Update sigv4 to latest pointer (#1702)
* update submodule pointer * Updating demo with Sigv4 latest changes * update manifest.yml
1 parent e7e171c commit 6eee7ec

File tree

3 files changed

+35
-11
lines changed

3 files changed

+35
-11
lines changed

demos/http/http_demo_s3_download/http_demo_s3_download.c

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,30 @@ static char pSigv4Auth[ AWS_HTTP_AUTH_HEADER_VALUE_LEN ];
343343
*/
344344
static size_t sigv4AuthLen = AWS_HTTP_AUTH_HEADER_VALUE_LEN;
345345

346+
/**
347+
* @brief The security token retrieved from AWS IoT credential provider
348+
* required for making HTTP requests to AWS S3.
349+
*/
350+
static const char * pSecurityToken;
351+
352+
/**
353+
* @brief Length of security token retrieved from AWS IoT credential provider
354+
* required for making HTTP requests to AWS S3.
355+
*/
356+
static size_t securityTokenLen;
357+
358+
/**
359+
* @brief The expiration time for the temporary credentials retrieved
360+
* from AWS IoT credential provider service.
361+
*/
362+
static const char * pExpiration;
363+
364+
/**
365+
* @brief Length of expiration time for the temporary credentials retrieved
366+
* from AWS IoT credential provider service.
367+
*/
368+
static size_t expirationLen;
369+
346370
/*-----------------------------------------------------------*/
347371

348372
/* Each compilation unit must define the NetworkContext struct. */
@@ -720,8 +744,8 @@ static JSONStatus_t parseCredentials( HTTPResponse_t * response,
720744
response->bodyLen,
721745
CREDENTIALS_RESPONSE_SESSION_TOKEN_KEY,
722746
strlen( CREDENTIALS_RESPONSE_SESSION_TOKEN_KEY ),
723-
( char ** ) &( sigvCreds->pSecurityToken ),
724-
&( sigvCreds->securityTokenLen ) );
747+
( char ** ) &( pSecurityToken ),
748+
&( securityTokenLen ) );
725749

726750
if( jsonStatus != JSONSuccess )
727751
{
@@ -736,16 +760,16 @@ static JSONStatus_t parseCredentials( HTTPResponse_t * response,
736760
response->bodyLen,
737761
CREDENTIALS_RESPONSE_EXPIRATION_DATE_KEY,
738762
strlen( CREDENTIALS_RESPONSE_EXPIRATION_DATE_KEY ),
739-
( char ** ) &( sigvCreds->pExpiration ),
740-
&( sigvCreds->expirationLen ) );
763+
( char ** ) &( pExpiration ),
764+
&( expirationLen ) );
741765

742766
if( jsonStatus != JSONSuccess )
743767
{
744768
LogError( ( "Error parsing expiration date in the credentials." ) );
745769
}
746770
else
747771
{
748-
LogInfo( ( "AWS IoT credentials will expire after this timestamp: %.*s.", ( int ) sigvCreds->expirationLen, sigvCreds->pExpiration ) );
772+
LogInfo( ( "AWS IoT credentials will expire after this timestamp: %.*s.", ( int ) expirationLen, pExpiration ) );
749773
}
750774
}
751775

@@ -1059,8 +1083,8 @@ static bool downloadS3ObjectFile( const TransportInterface_t * pTransportInterfa
10591083
httpStatus = HTTPClient_AddHeader( &requestHeaders,
10601084
( const char * ) SIGV4_HTTP_X_AMZ_SECURITY_TOKEN_HEADER,
10611085
( size_t ) ( sizeof( SIGV4_HTTP_X_AMZ_SECURITY_TOKEN_HEADER ) - 1 ),
1062-
( const char * ) sigvCreds.pSecurityToken,
1063-
( size_t ) sigvCreds.securityTokenLen );
1086+
( const char * ) pSecurityToken,
1087+
( size_t ) securityTokenLen );
10641088

10651089
if( httpStatus != HTTPSuccess )
10661090
{
@@ -1320,8 +1344,8 @@ static bool getS3ObjectFileSize( size_t * pFileSize,
13201344
httpStatus = HTTPClient_AddHeader( &requestHeaders,
13211345
( const char * ) SIGV4_HTTP_X_AMZ_SECURITY_TOKEN_HEADER,
13221346
( size_t ) ( sizeof( SIGV4_HTTP_X_AMZ_SECURITY_TOKEN_HEADER ) - 1 ),
1323-
( const char * ) sigvCreds.pSecurityToken,
1324-
( size_t ) sigvCreds.securityTokenLen );
1347+
( const char * ) pSecurityToken,
1348+
( size_t ) securityTokenLen );
13251349

13261350
if( httpStatus != HTTPSuccess )
13271351
{

manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ dependencies:
6868
url: "https://github.com/aws/Fleet-Provisioning-for-AWS-IoT-embedded-sdk"
6969
path: "libraries/aws/fleet-provisioning-for-aws-iot-embedded-sdk"
7070
- name: "sigv4-for-AWS-IoT-embedded-sdk"
71-
version: "8e45468"
71+
version: "534bb1d"
7272
repository:
7373
type: "git"
7474
url: "https://github.com/aws/SigV4-for-AWS-IoT-embedded-sdk"

0 commit comments

Comments
 (0)