Skip to content
This repository was archived by the owner on Feb 12, 2022. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update service_credentials_provider.cpp
  • Loading branch information
AAlon authored Jan 25, 2019
commit 8294460ec7ff86c40616bf5876e12514f6d55cdb
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,14 @@ bool IotRoleCredentialsProvider::ValidateResponse(Json::JsonValue & value)
return false;
}

if (!value.ValueExists(FIELD_CREDENTIALS)) {
auto value_view = value.View();
if (!value_view.ValueExists(FIELD_CREDENTIALS)) {
AWS_LOG_ERROR(AWS_LOG_TAG, "Unable to find %s field in AWS IoT credential provider response",
FIELD_CREDENTIALS);
return false;
}

auto creds = value.GetObject(FIELD_CREDENTIALS);
auto creds = value_view.GetObject(FIELD_CREDENTIALS);

if (!creds.IsObject()) {
AWS_LOG_ERROR(AWS_LOG_TAG, "Expected object for %s in AWS IoT credential provider response",
Expand Down Expand Up @@ -467,7 +468,7 @@ void IotRoleCredentialsProvider::Refresh()
auto value = ctx.GetValue();
if (!ValidateResponse(value)) goto cleanup_curl;

auto creds_obj = value.GetObject(FIELD_CREDENTIALS);
auto creds_obj = value.View().GetObject(FIELD_CREDENTIALS);

// Retrieve expiration date
auto expires_str = creds_obj.GetString(FIELD_EXPIRATION);
Expand Down