Go to the documentation of this file.
25 #include "absl/status/status.h"
26 #include "absl/status/statusor.h"
27 #include "absl/strings/str_cat.h"
28 #include "absl/strings/str_format.h"
29 #include "absl/strings/str_split.h"
30 #include "absl/strings/string_view.h"
47 RefCountedPtr<UrlExternalAccountCredentials>
49 std::vector<std::string> scopes,
51 auto creds = MakeRefCounted<UrlExternalAccountCredentials>(
63 auto it =
options.credential_source.object_value().find(
"url");
64 if (
it ==
options.credential_source.object_value().end()) {
77 tmp_url.
status().ToString()));
82 std::vector<absl::string_view>
v =
85 it =
options.credential_source.object_value().find(
"headers");
86 if (
it !=
options.credential_source.object_value().end()) {
89 "The JSON value of credential source headers is not an object.");
92 for (
auto const&
header :
it->second.object_value()) {
96 it =
options.credential_source.object_value().find(
"format");
97 if (
it !=
options.credential_source.object_value().end()) {
98 const Json& format_json =
it->second;
101 "The JSON value of credential source format is not an object.");
104 auto format_it = format_json.
object_value().find(
"type");
107 "format.type field not present.");
112 "format.type field must be a string.");
117 format_it = format_json.
object_value().find(
"subject_token_field_name");
120 "format.subject_token_field_name field must be present if the "
121 "format is in Json.");
126 "format.subject_token_field_name field must be a string.");
137 if (
ctx ==
nullptr) {
141 "Missing HTTPRequestContext to start subject token retrieval."));
144 auto url_for_request =
147 if (!url_for_request.ok()) {
211 "The format of response is not a valid json object."));
216 if (response_it == response_json.
object_value().end()) {
218 "Subject token field not present."));
224 "Subject token field must be a string."));
strings_internal::Splitter< typename strings_internal::SelectDelimiter< Delimiter >::type, AllowEmpty, absl::string_view > StrSplit(strings_internal::ConvertibleToStringView text, Delimiter d)
#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler)
strings_internal::MaxSplitsImpl< typename strings_internal::SelectDelimiter< Delimiter >::type > MaxSplits(Delimiter delimiter, int limit)
static RefCountedPtr< UrlExternalAccountCredentials > Create(Options options, std::vector< std::string > scopes, grpc_error_handle *error)
void FinishRetrieveSubjectToken(std::string subject_token, grpc_error_handle error)
std::string StrCat(const AlphaNum &a, const AlphaNum &b)
return memset(p, 0, total)
ABSL_MUST_USE_RESULT std::string StrFormat(const FormatSpec< Args... > &format, const Args &... args)
grpc_polling_entity * pollent
const Object & object_value() const
GPRAPI void * gpr_malloc(size_t size)
static struct test_ctx ctx
RefCountedPtr< grpc_channel_credentials > CreateHttpRequestSSLCredentials()
static absl::StatusOr< URI > Parse(absl::string_view uri_text)
std::string format_subject_token_field_name_
void grpc_http_request_destroy(grpc_http_request *request)
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
const std::string & authority() const
JSON (JavaScript Object Notation).
OrphanablePtr< HttpRequest > http_request_
struct absl::base_internal::@2940::AllocList::Header header
void OnRetrieveSubjectTokenInternal(grpc_error_handle error)
GRPCAPI grpc_channel_credentials * grpc_insecure_credentials_create()
void grpc_http_response_destroy(grpc_http_response *response)
static void OnRetrieveSubjectToken(void *arg, grpc_error_handle error)
#define GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc)
static Json Parse(absl::string_view json_str, grpc_error_handle *error)
HTTPRequestContext * ctx_
grpc_http_response response
UrlExternalAccountCredentials(Options options, std::vector< std::string > scopes, grpc_error_handle *error)
const std::string & scheme() const
ABSL_MUST_USE_RESULT bool ok() const
#define GRPC_ERROR_REF(err)
grpc_error_handle absl_status_to_grpc_error(absl::Status status)
static OrphanablePtr< HttpRequest > Get(URI uri, const grpc_channel_args *args, grpc_polling_entity *pollent, const grpc_http_request *request, Timestamp deadline, grpc_closure *on_done, grpc_http_response *response, RefCountedPtr< grpc_channel_credentials > channel_creds) GRPC_MUST_USE_RESULT
static absl::StatusOr< URI > Create(std::string scheme, std::string authority, std::string path, std::vector< QueryParam > query_parameter_pairs, std::string fragment)
#define GRPC_ERROR_CREATE_FROM_CPP_STRING(desc)
std::map< std::string, std::string > headers_
std::string url_full_path_
std::function< void(std::string, grpc_error_handle)> cb_
GPRAPI char * gpr_strdup(const char *src)
void RetrieveSubjectToken(HTTPRequestContext *ctx, const Options &options, std::function< void(std::string, grpc_error_handle)> cb) override
OPENSSL_EXPORT pem_password_cb * cb
const Status & status() const &
#define GRPC_ERROR_IS_NONE(err)
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:48