#include <grpc/support/port_platform.h>
#include "src/core/lib/security/credentials/external/aws_external_account_credentials.h"
#include <string.h>
#include <initializer_list>
#include <map>
#include <utility>
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/str_replace.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/gprpp/env.h"
#include "src/core/lib/gprpp/host_port.h"
#include "src/core/lib/http/httpcli_ssl_credentials.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/json/json.h"
#include "src/core/lib/security/credentials/credentials.h"
#include "src/core/lib/uri/uri_parser.h"
namespace grpc_core {
namespace {
const char* awsEc2MetadataIpv4Address = …;
const char* awsEc2MetadataIpv6Address = …;
const char* kExpectedEnvironmentId = …;
const char* kRegionEnvVar = …;
const char* kDefaultRegionEnvVar = …;
const char* kAccessKeyIdEnvVar = …;
const char* kSecretAccessKeyEnvVar = …;
const char* kSessionTokenEnvVar = …;
std::string UrlEncode(const absl::string_view& s) { … }
bool ValidateAwsUrl(const std::string& urlString) { … }
}
RefCountedPtr<AwsExternalAccountCredentials>
AwsExternalAccountCredentials::Create(Options options,
std::vector<std::string> scopes,
grpc_error_handle* error) { … }
AwsExternalAccountCredentials::AwsExternalAccountCredentials(
Options options, std::vector<std::string> scopes, grpc_error_handle* error)
: … { … }
void AwsExternalAccountCredentials::RetrieveSubjectToken(
HTTPRequestContext* ctx, const Options& ,
std::function<void(std::string, grpc_error_handle)> cb) { … }
void AwsExternalAccountCredentials::RetrieveImdsV2SessionToken() { … }
void AwsExternalAccountCredentials::OnRetrieveImdsV2SessionToken(
void* arg, grpc_error_handle error) { … }
void AwsExternalAccountCredentials::OnRetrieveImdsV2SessionTokenInternal(
grpc_error_handle error) { … }
void AwsExternalAccountCredentials::AddMetadataRequestHeaders(
grpc_http_request* request) { … }
void AwsExternalAccountCredentials::RetrieveRegion() { … }
void AwsExternalAccountCredentials::OnRetrieveRegion(void* arg,
grpc_error_handle error) { … }
void AwsExternalAccountCredentials::OnRetrieveRegionInternal(
grpc_error_handle error) { … }
void AwsExternalAccountCredentials::RetrieveRoleName() { … }
void AwsExternalAccountCredentials::OnRetrieveRoleName(
void* arg, grpc_error_handle error) { … }
void AwsExternalAccountCredentials::OnRetrieveRoleNameInternal(
grpc_error_handle error) { … }
void AwsExternalAccountCredentials::RetrieveSigningKeys() { … }
void AwsExternalAccountCredentials::OnRetrieveSigningKeys(
void* arg, grpc_error_handle error) { … }
void AwsExternalAccountCredentials::OnRetrieveSigningKeysInternal(
grpc_error_handle error) { … }
void AwsExternalAccountCredentials::BuildSubjectToken() { … }
void AwsExternalAccountCredentials::FinishRetrieveSubjectToken(
std::string subject_token, grpc_error_handle error) { … }
}