#include "aws_common/sdk_utils/auth/service_credentials_provider.h"
#include <aws/core/Aws.h>
#include <aws/core/utils/Array.h>
#include <aws/core/utils/DateTime.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <curl/curl.h>
#include "aws_common/sdk_utils/aws_error.h"
#include "aws_common/sdk_utils/parameter_reader.h"
Go to the source code of this file.
Classes | |
class | Aws::Auth::RequestContext |
Encapsulates the response from a curl request Curl uses a callback when performing a request for chunks of data. This class serves as a the request data, using an Aws::StringStream to accumulate data in memory. At any time, the GetValue() method can be used to return a Json::JsonValue respresentation of the currently buffered data. More... | |
Namespaces | |
Aws | |
Aws::Auth | |
Macros | |
#define | FIELD_ACCESS_KEY "accessKeyId" |
Name of the field containing the access key id in the json response from IoT. More... | |
#define | FIELD_CREDENTIALS "credentials" |
Name of the credentials object in the json response from IoT. More... | |
#define | FIELD_EXPIRATION "expiration" |
Name of the field containing the expiration date in the json response from IoT. More... | |
#define | FIELD_SECRET_KEY "secretAccessKey" |
Name of the field containing the secret key in the json response from IoT. More... | |
#define | FIELD_SESSION_TOKEN "sessionToken" |
Name of the field containing the session token in the json response from IoT. More... | |
#define | HEADER_THING_NAME "x-amzn-iot-thingname" |
Header name to append to the request containing the thing name. More... | |
#define | MAX_IOT_CREDENTIAL_BYTES 65535 |
Functions | |
static bool | Aws::Auth::AppendHeader (struct curl_slist **headers, const char *name, const char *value) |
Appends a name/value pair to a list of curl headers The libcurl API potentially returns new list pointer when a value is appended but also returns NULL as an error. This function tries to append the header value, and returns false if an error occurs and leaves the headers pointer untouched. More... | |
template<typename T > | |
static bool | Aws::Auth::GetConfigValue (std::map< std::string, std::string > &data, const char *name, T &result, bool optional) |
Helper to retrieve a specific config value from a map Simple helper to try to retrieve data from a map and log a message if it was not available. If no value is found, result is unchanged. More... | |
bool | Aws::Auth::GetServiceAuthConfig (ServiceAuthConfig &config, const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meters) |
Retrieves service authorization data from a ParameterReaderInterface and populates the ServiceAuthConfig structure from the available parameters. If it was able to load configuration data and successfully populate the structure, the function will return true, otherwise false. More... | |
static bool | Aws::Auth::IsIotConfigValid (const IotRoleConfig &config) |
Validates an instance of an IotRoleConfig struct. More... | |
static bool | Aws::Auth::ParseConfigVale (std::string &value, Aws::String &result) |
static bool | Aws::Auth::ParseConfigValue (std::string &value, int32_t &result) |
Helper to parse a configuration value into an Aws::String variable This function assumes that the value will be greater than zero, otherwise it will assume an error (since it's used for timeouts) More... | |
static bool | Aws::Auth::ParseConfigValue (std::string &value, Aws::String &result) |
Helper to parse a configuration value into an Aws::String variable. More... | |
template<typename T > | |
static bool | Aws::Auth::SetCurlOpt (CURL *curl, CURLoption opt, T lvalue) |
Helper to set a libcurl option or log an error if a problem occurred. More... | |
Variables | |
static const char * | AWS_LOG_TAG = "ServiceCredentialsProviderChain" |
Logging tag used for all messages emitting from this module. More... | |
static const double | EXPIRATION_GRACE_BUFFER = 30.0 |
Go ahead and try to refresh credentials 30s before expiration. More... | |
#define FIELD_ACCESS_KEY "accessKeyId" |
Name of the field containing the access key id in the json response from IoT.
Definition at line 33 of file service_credentials_provider.cpp.
#define FIELD_CREDENTIALS "credentials" |
Name of the credentials object in the json response from IoT.
Definition at line 29 of file service_credentials_provider.cpp.
#define FIELD_EXPIRATION "expiration" |
Name of the field containing the expiration date in the json response from IoT.
Definition at line 31 of file service_credentials_provider.cpp.
#define FIELD_SECRET_KEY "secretAccessKey" |
Name of the field containing the secret key in the json response from IoT.
Definition at line 35 of file service_credentials_provider.cpp.
#define FIELD_SESSION_TOKEN "sessionToken" |
Name of the field containing the session token in the json response from IoT.
Definition at line 37 of file service_credentials_provider.cpp.
#define HEADER_THING_NAME "x-amzn-iot-thingname" |
Header name to append to the request containing the thing name.
Definition at line 40 of file service_credentials_provider.cpp.
#define MAX_IOT_CREDENTIAL_BYTES 65535 |
The maximum size of a credentials response from the IoT service that will be tolerated by the provider
Definition at line 45 of file service_credentials_provider.cpp.
|
static |
Logging tag used for all messages emitting from this module.
Definition at line 49 of file service_credentials_provider.cpp.
|
static |
Go ahead and try to refresh credentials 30s before expiration.
Definition at line 52 of file service_credentials_provider.cpp.