[security] add token fetcher interface to alts creds client options (#40477)
The protos in the handshaker folder seem to be dead. Will remove them in a follow-up.
Closes #40477
PiperOrigin-RevId: 802599483
diff --git a/BUILD b/BUILD
index 01773bb..04be308 100644
--- a/BUILD
+++ b/BUILD
@@ -2430,6 +2430,7 @@
],
external_deps = [
"absl/log:log",
+ "absl/status:statusor",
"@com_google_protobuf//upb/base",
"@com_google_protobuf//upb/mem",
],
diff --git a/src/core/credentials/transport/alts/grpc_alts_credentials_client_options.cc b/src/core/credentials/transport/alts/grpc_alts_credentials_client_options.cc
index 8c448b7..ae43b92 100644
--- a/src/core/credentials/transport/alts/grpc_alts_credentials_client_options.cc
+++ b/src/core/credentials/transport/alts/grpc_alts_credentials_client_options.cc
@@ -21,6 +21,8 @@
#include <grpc/support/port_platform.h>
#include <grpc/support/string_util.h>
+#include <memory>
+
#include "absl/log/log.h"
#include "src/core/credentials/transport/alts/grpc_alts_credentials_options.h"
#include "src/core/tsi/alts/handshaker/transport_security_common_api.h"
@@ -101,12 +103,25 @@
prev = new_node;
node = node->next;
}
+ new_client_options->token_fetcher =
+ reinterpret_cast<const grpc_alts_credentials_client_options*>(options)
+ ->token_fetcher;
// Copy rpc protocol versions.
grpc_gcp_rpc_protocol_versions_copy(&options->rpc_versions,
&new_options->rpc_versions);
return new_options;
}
+void grpc_alts_credentials_client_options_set_token_fetcher(
+ grpc_alts_credentials_options* options,
+ std::shared_ptr<grpc::alts::TokenFetcher> token_fetcher) {
+ if (options == nullptr) {
+ return;
+ }
+ reinterpret_cast<grpc_alts_credentials_client_options*>(options)
+ ->token_fetcher = token_fetcher;
+}
+
static void alts_client_options_destroy(
grpc_alts_credentials_options* options) {
if (options == nullptr) {
@@ -120,4 +135,5 @@
target_service_account_destroy(node);
node = next_node;
}
+ client_options->token_fetcher.reset();
}
diff --git a/src/core/credentials/transport/alts/grpc_alts_credentials_options.h b/src/core/credentials/transport/alts/grpc_alts_credentials_options.h
index 099f420..2fe527c 100644
--- a/src/core/credentials/transport/alts/grpc_alts_credentials_options.h
+++ b/src/core/credentials/transport/alts/grpc_alts_credentials_options.h
@@ -23,8 +23,28 @@
#include <grpc/grpc_security.h>
#include <grpc/support/port_platform.h>
+#include <memory>
+#include <string>
+
+#include "absl/status/statusor.h"
#include "src/core/tsi/alts/handshaker/transport_security_common_api.h"
+namespace grpc::alts {
+
+// Its implementation must be thread-safe.
+class TokenFetcher {
+ public:
+ virtual ~TokenFetcher() = default;
+
+ // Thread-safe and non-blocking. The returned token must be strongly bound.
+ // Failure to comply with this requirement will result in a serious security
+ // issue. The token must also be valid for at least 9 hours to outlive an
+ // arbitrary ALTS connection.
+ virtual absl::StatusOr<std::string> GetToken() = 0;
+};
+
+} // namespace grpc::alts
+
// V-table for grpc_alts_credentials_options
typedef struct grpc_alts_credentials_options_vtable {
grpc_alts_credentials_options* (*copy)(
@@ -50,6 +70,7 @@
typedef struct grpc_alts_credentials_client_options {
grpc_alts_credentials_options base;
target_service_account* target_account_list_head;
+ std::shared_ptr<grpc::alts::TokenFetcher> token_fetcher;
} grpc_alts_credentials_client_options;
///
@@ -71,4 +92,8 @@
grpc_alts_credentials_options* grpc_alts_credentials_options_copy(
const grpc_alts_credentials_options* options);
+void grpc_alts_credentials_client_options_set_token_fetcher(
+ grpc_alts_credentials_options* options,
+ std::shared_ptr<grpc::alts::TokenFetcher> token_fetcher);
+
#endif // GRPC_SRC_CORE_CREDENTIALS_TRANSPORT_ALTS_GRPC_ALTS_CREDENTIALS_OPTIONS_H
diff --git a/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb.h b/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb.h
index 194d7f2..672145c 100644
--- a/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb.h
+++ b/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb.h
@@ -336,11 +336,11 @@
return ret;
}
UPB_INLINE void grpc_gcp_StartClientHandshakeReq_clear_application_protocols(grpc_gcp_StartClientHandshakeReq* msg) {
- const upb_MiniTableField field = {2, UPB_SIZE(16, 40), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
}
UPB_INLINE upb_StringView const* grpc_gcp_StartClientHandshakeReq_application_protocols(const grpc_gcp_StartClientHandshakeReq* msg, size_t* size) {
- const upb_MiniTableField field = {2, UPB_SIZE(16, 40), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
if (arr) {
if (size) *size = arr->UPB_PRIVATE(size);
@@ -351,7 +351,7 @@
}
}
UPB_INLINE const upb_Array* _grpc_gcp_StartClientHandshakeReq_application_protocols_upb_array(const grpc_gcp_StartClientHandshakeReq* msg, size_t* size) {
- const upb_MiniTableField field = {2, UPB_SIZE(16, 40), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
if (size) {
*size = arr ? arr->UPB_PRIVATE(size) : 0;
@@ -359,7 +359,7 @@
return arr;
}
UPB_INLINE upb_Array* _grpc_gcp_StartClientHandshakeReq_application_protocols_mutable_upb_array(grpc_gcp_StartClientHandshakeReq* msg, size_t* size, upb_Arena* arena) {
- const upb_MiniTableField field = {2, UPB_SIZE(16, 40), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
&field, arena);
if (size) {
@@ -368,11 +368,11 @@
return arr;
}
UPB_INLINE void grpc_gcp_StartClientHandshakeReq_clear_record_protocols(grpc_gcp_StartClientHandshakeReq* msg) {
- const upb_MiniTableField field = {3, UPB_SIZE(20, 48), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {3, UPB_SIZE(20, 64), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
}
UPB_INLINE upb_StringView const* grpc_gcp_StartClientHandshakeReq_record_protocols(const grpc_gcp_StartClientHandshakeReq* msg, size_t* size) {
- const upb_MiniTableField field = {3, UPB_SIZE(20, 48), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {3, UPB_SIZE(20, 64), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
if (arr) {
if (size) *size = arr->UPB_PRIVATE(size);
@@ -383,7 +383,7 @@
}
}
UPB_INLINE const upb_Array* _grpc_gcp_StartClientHandshakeReq_record_protocols_upb_array(const grpc_gcp_StartClientHandshakeReq* msg, size_t* size) {
- const upb_MiniTableField field = {3, UPB_SIZE(20, 48), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {3, UPB_SIZE(20, 64), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
if (size) {
*size = arr ? arr->UPB_PRIVATE(size) : 0;
@@ -391,7 +391,7 @@
return arr;
}
UPB_INLINE upb_Array* _grpc_gcp_StartClientHandshakeReq_record_protocols_mutable_upb_array(grpc_gcp_StartClientHandshakeReq* msg, size_t* size, upb_Arena* arena) {
- const upb_MiniTableField field = {3, UPB_SIZE(20, 48), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {3, UPB_SIZE(20, 64), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
&field, arena);
if (size) {
@@ -400,11 +400,11 @@
return arr;
}
UPB_INLINE void grpc_gcp_StartClientHandshakeReq_clear_target_identities(grpc_gcp_StartClientHandshakeReq* msg) {
- const upb_MiniTableField field = {4, UPB_SIZE(24, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {4, UPB_SIZE(24, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
}
UPB_INLINE const grpc_gcp_Identity* const* grpc_gcp_StartClientHandshakeReq_target_identities(const grpc_gcp_StartClientHandshakeReq* msg, size_t* size) {
- const upb_MiniTableField field = {4, UPB_SIZE(24, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {4, UPB_SIZE(24, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__Identity_msg_init);
const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
if (arr) {
@@ -416,7 +416,7 @@
}
}
UPB_INLINE const upb_Array* _grpc_gcp_StartClientHandshakeReq_target_identities_upb_array(const grpc_gcp_StartClientHandshakeReq* msg, size_t* size) {
- const upb_MiniTableField field = {4, UPB_SIZE(24, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {4, UPB_SIZE(24, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__Identity_msg_init);
const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
if (size) {
@@ -425,7 +425,7 @@
return arr;
}
UPB_INLINE upb_Array* _grpc_gcp_StartClientHandshakeReq_target_identities_mutable_upb_array(grpc_gcp_StartClientHandshakeReq* msg, size_t* size, upb_Arena* arena) {
- const upb_MiniTableField field = {4, UPB_SIZE(24, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {4, UPB_SIZE(24, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__Identity_msg_init);
upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
&field, arena);
@@ -435,54 +435,54 @@
return arr;
}
UPB_INLINE void grpc_gcp_StartClientHandshakeReq_clear_local_identity(grpc_gcp_StartClientHandshakeReq* msg) {
- const upb_MiniTableField field = {5, UPB_SIZE(28, 64), 64, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {5, UPB_SIZE(28, 80), 64, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
}
UPB_INLINE const grpc_gcp_Identity* grpc_gcp_StartClientHandshakeReq_local_identity(const grpc_gcp_StartClientHandshakeReq* msg) {
const grpc_gcp_Identity* default_val = NULL;
const grpc_gcp_Identity* ret;
- const upb_MiniTableField field = {5, UPB_SIZE(28, 64), 64, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {5, UPB_SIZE(28, 80), 64, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__Identity_msg_init);
_upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
&default_val, &ret);
return ret;
}
UPB_INLINE bool grpc_gcp_StartClientHandshakeReq_has_local_identity(const grpc_gcp_StartClientHandshakeReq* msg) {
- const upb_MiniTableField field = {5, UPB_SIZE(28, 64), 64, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {5, UPB_SIZE(28, 80), 64, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
}
UPB_INLINE void grpc_gcp_StartClientHandshakeReq_clear_local_endpoint(grpc_gcp_StartClientHandshakeReq* msg) {
- const upb_MiniTableField field = {6, UPB_SIZE(32, 72), 65, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {6, UPB_SIZE(32, 88), 65, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
}
UPB_INLINE const grpc_gcp_Endpoint* grpc_gcp_StartClientHandshakeReq_local_endpoint(const grpc_gcp_StartClientHandshakeReq* msg) {
const grpc_gcp_Endpoint* default_val = NULL;
const grpc_gcp_Endpoint* ret;
- const upb_MiniTableField field = {6, UPB_SIZE(32, 72), 65, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {6, UPB_SIZE(32, 88), 65, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__Endpoint_msg_init);
_upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
&default_val, &ret);
return ret;
}
UPB_INLINE bool grpc_gcp_StartClientHandshakeReq_has_local_endpoint(const grpc_gcp_StartClientHandshakeReq* msg) {
- const upb_MiniTableField field = {6, UPB_SIZE(32, 72), 65, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {6, UPB_SIZE(32, 88), 65, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
}
UPB_INLINE void grpc_gcp_StartClientHandshakeReq_clear_remote_endpoint(grpc_gcp_StartClientHandshakeReq* msg) {
- const upb_MiniTableField field = {7, UPB_SIZE(36, 80), 66, 3, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {7, UPB_SIZE(36, 96), 66, 3, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
}
UPB_INLINE const grpc_gcp_Endpoint* grpc_gcp_StartClientHandshakeReq_remote_endpoint(const grpc_gcp_StartClientHandshakeReq* msg) {
const grpc_gcp_Endpoint* default_val = NULL;
const grpc_gcp_Endpoint* ret;
- const upb_MiniTableField field = {7, UPB_SIZE(36, 80), 66, 3, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {7, UPB_SIZE(36, 96), 66, 3, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__Endpoint_msg_init);
_upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
&default_val, &ret);
return ret;
}
UPB_INLINE bool grpc_gcp_StartClientHandshakeReq_has_remote_endpoint(const grpc_gcp_StartClientHandshakeReq* msg) {
- const upb_MiniTableField field = {7, UPB_SIZE(36, 80), 66, 3, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {7, UPB_SIZE(36, 96), 66, 3, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
}
UPB_INLINE void grpc_gcp_StartClientHandshakeReq_clear_target_name(grpc_gcp_StartClientHandshakeReq* msg) {
@@ -498,20 +498,20 @@
return ret;
}
UPB_INLINE void grpc_gcp_StartClientHandshakeReq_clear_rpc_versions(grpc_gcp_StartClientHandshakeReq* msg) {
- const upb_MiniTableField field = {9, UPB_SIZE(40, 88), 67, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {9, UPB_SIZE(40, 104), 67, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
}
UPB_INLINE const struct grpc_gcp_RpcProtocolVersions* grpc_gcp_StartClientHandshakeReq_rpc_versions(const grpc_gcp_StartClientHandshakeReq* msg) {
const struct grpc_gcp_RpcProtocolVersions* default_val = NULL;
const struct grpc_gcp_RpcProtocolVersions* ret;
- const upb_MiniTableField field = {9, UPB_SIZE(40, 88), 67, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {9, UPB_SIZE(40, 104), 67, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__RpcProtocolVersions_msg_init);
_upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
&default_val, &ret);
return ret;
}
UPB_INLINE bool grpc_gcp_StartClientHandshakeReq_has_rpc_versions(const grpc_gcp_StartClientHandshakeReq* msg) {
- const upb_MiniTableField field = {9, UPB_SIZE(40, 88), 67, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {9, UPB_SIZE(40, 104), 67, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
}
UPB_INLINE void grpc_gcp_StartClientHandshakeReq_clear_max_frame_size(grpc_gcp_StartClientHandshakeReq* msg) {
@@ -526,21 +526,33 @@
&default_val, &ret);
return ret;
}
+UPB_INLINE void grpc_gcp_StartClientHandshakeReq_clear_access_token(grpc_gcp_StartClientHandshakeReq* msg) {
+ const upb_MiniTableField field = {11, UPB_SIZE(60, 40), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
+ upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
+}
+UPB_INLINE upb_StringView grpc_gcp_StartClientHandshakeReq_access_token(const grpc_gcp_StartClientHandshakeReq* msg) {
+ upb_StringView default_val = upb_StringView_FromString("");
+ upb_StringView ret;
+ const upb_MiniTableField field = {11, UPB_SIZE(60, 40), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
+ _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
+ &default_val, &ret);
+ return ret;
+}
UPB_INLINE void grpc_gcp_StartClientHandshakeReq_clear_transport_protocol_preferences(grpc_gcp_StartClientHandshakeReq* msg) {
- const upb_MiniTableField field = {12, UPB_SIZE(48, 96), 68, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {12, UPB_SIZE(48, 112), 68, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
}
UPB_INLINE const struct grpc_gcp_TransportProtocolPreferences* grpc_gcp_StartClientHandshakeReq_transport_protocol_preferences(const grpc_gcp_StartClientHandshakeReq* msg) {
const struct grpc_gcp_TransportProtocolPreferences* default_val = NULL;
const struct grpc_gcp_TransportProtocolPreferences* ret;
- const upb_MiniTableField field = {12, UPB_SIZE(48, 96), 68, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {12, UPB_SIZE(48, 112), 68, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__TransportProtocolPreferences_msg_init);
_upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
&default_val, &ret);
return ret;
}
UPB_INLINE bool grpc_gcp_StartClientHandshakeReq_has_transport_protocol_preferences(const grpc_gcp_StartClientHandshakeReq* msg) {
- const upb_MiniTableField field = {12, UPB_SIZE(48, 96), 68, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {12, UPB_SIZE(48, 112), 68, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
return upb_Message_HasBaseField(UPB_UPCAST(msg), &field);
}
@@ -549,7 +561,7 @@
upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
}
UPB_INLINE upb_StringView* grpc_gcp_StartClientHandshakeReq_mutable_application_protocols(grpc_gcp_StartClientHandshakeReq* msg, size_t* size) {
- upb_MiniTableField field = {2, UPB_SIZE(16, 40), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
if (arr) {
if (size) *size = arr->UPB_PRIVATE(size);
@@ -560,12 +572,12 @@
}
}
UPB_INLINE upb_StringView* grpc_gcp_StartClientHandshakeReq_resize_application_protocols(grpc_gcp_StartClientHandshakeReq* msg, size_t size, upb_Arena* arena) {
- upb_MiniTableField field = {2, UPB_SIZE(16, 40), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
&field, size, arena);
}
UPB_INLINE bool grpc_gcp_StartClientHandshakeReq_add_application_protocols(grpc_gcp_StartClientHandshakeReq* msg, upb_StringView val, upb_Arena* arena) {
- upb_MiniTableField field = {2, UPB_SIZE(16, 40), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ upb_MiniTableField field = {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Array* arr = upb_Message_GetOrCreateMutableArray(
UPB_UPCAST(msg), &field, arena);
if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
@@ -577,7 +589,7 @@
return true;
}
UPB_INLINE upb_StringView* grpc_gcp_StartClientHandshakeReq_mutable_record_protocols(grpc_gcp_StartClientHandshakeReq* msg, size_t* size) {
- upb_MiniTableField field = {3, UPB_SIZE(20, 48), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ upb_MiniTableField field = {3, UPB_SIZE(20, 64), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
if (arr) {
if (size) *size = arr->UPB_PRIVATE(size);
@@ -588,12 +600,12 @@
}
}
UPB_INLINE upb_StringView* grpc_gcp_StartClientHandshakeReq_resize_record_protocols(grpc_gcp_StartClientHandshakeReq* msg, size_t size, upb_Arena* arena) {
- upb_MiniTableField field = {3, UPB_SIZE(20, 48), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ upb_MiniTableField field = {3, UPB_SIZE(20, 64), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
&field, size, arena);
}
UPB_INLINE bool grpc_gcp_StartClientHandshakeReq_add_record_protocols(grpc_gcp_StartClientHandshakeReq* msg, upb_StringView val, upb_Arena* arena) {
- upb_MiniTableField field = {3, UPB_SIZE(20, 48), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ upb_MiniTableField field = {3, UPB_SIZE(20, 64), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Array* arr = upb_Message_GetOrCreateMutableArray(
UPB_UPCAST(msg), &field, arena);
if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
@@ -605,7 +617,7 @@
return true;
}
UPB_INLINE grpc_gcp_Identity** grpc_gcp_StartClientHandshakeReq_mutable_target_identities(grpc_gcp_StartClientHandshakeReq* msg, size_t* size) {
- upb_MiniTableField field = {4, UPB_SIZE(24, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ upb_MiniTableField field = {4, UPB_SIZE(24, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__Identity_msg_init);
upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
if (arr) {
@@ -617,12 +629,12 @@
}
}
UPB_INLINE grpc_gcp_Identity** grpc_gcp_StartClientHandshakeReq_resize_target_identities(grpc_gcp_StartClientHandshakeReq* msg, size_t size, upb_Arena* arena) {
- upb_MiniTableField field = {4, UPB_SIZE(24, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ upb_MiniTableField field = {4, UPB_SIZE(24, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
return (grpc_gcp_Identity**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
&field, size, arena);
}
UPB_INLINE struct grpc_gcp_Identity* grpc_gcp_StartClientHandshakeReq_add_target_identities(grpc_gcp_StartClientHandshakeReq* msg, upb_Arena* arena) {
- upb_MiniTableField field = {4, UPB_SIZE(24, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ upb_MiniTableField field = {4, UPB_SIZE(24, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__Identity_msg_init);
upb_Array* arr = upb_Message_GetOrCreateMutableArray(
UPB_UPCAST(msg), &field, arena);
@@ -637,7 +649,7 @@
return sub;
}
UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_local_identity(grpc_gcp_StartClientHandshakeReq *msg, grpc_gcp_Identity* value) {
- const upb_MiniTableField field = {5, UPB_SIZE(28, 64), 64, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {5, UPB_SIZE(28, 80), 64, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__Identity_msg_init);
upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
}
@@ -650,7 +662,7 @@
return sub;
}
UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_local_endpoint(grpc_gcp_StartClientHandshakeReq *msg, grpc_gcp_Endpoint* value) {
- const upb_MiniTableField field = {6, UPB_SIZE(32, 72), 65, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {6, UPB_SIZE(32, 88), 65, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__Endpoint_msg_init);
upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
}
@@ -663,7 +675,7 @@
return sub;
}
UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_remote_endpoint(grpc_gcp_StartClientHandshakeReq *msg, grpc_gcp_Endpoint* value) {
- const upb_MiniTableField field = {7, UPB_SIZE(36, 80), 66, 3, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {7, UPB_SIZE(36, 96), 66, 3, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__Endpoint_msg_init);
upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
}
@@ -680,7 +692,7 @@
upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
}
UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_rpc_versions(grpc_gcp_StartClientHandshakeReq *msg, struct grpc_gcp_RpcProtocolVersions* value) {
- const upb_MiniTableField field = {9, UPB_SIZE(40, 88), 67, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {9, UPB_SIZE(40, 104), 67, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__RpcProtocolVersions_msg_init);
upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
}
@@ -696,8 +708,12 @@
const upb_MiniTableField field = {10, UPB_SIZE(44, 16), 0, kUpb_NoSub, 13, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)};
upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
}
+UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_access_token(grpc_gcp_StartClientHandshakeReq *msg, upb_StringView value) {
+ const upb_MiniTableField field = {11, UPB_SIZE(60, 40), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
+}
UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_transport_protocol_preferences(grpc_gcp_StartClientHandshakeReq *msg, struct grpc_gcp_TransportProtocolPreferences* value) {
- const upb_MiniTableField field = {12, UPB_SIZE(48, 96), 68, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {12, UPB_SIZE(48, 112), 68, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__TransportProtocolPreferences_msg_init);
upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
}
@@ -747,11 +763,11 @@
return ptr;
}
UPB_INLINE void grpc_gcp_ServerHandshakeParameters_clear_record_protocols(grpc_gcp_ServerHandshakeParameters* msg) {
- const upb_MiniTableField field = {1, 8, 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {1, UPB_SIZE(8, 24), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
}
UPB_INLINE upb_StringView const* grpc_gcp_ServerHandshakeParameters_record_protocols(const grpc_gcp_ServerHandshakeParameters* msg, size_t* size) {
- const upb_MiniTableField field = {1, 8, 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {1, UPB_SIZE(8, 24), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
if (arr) {
if (size) *size = arr->UPB_PRIVATE(size);
@@ -762,7 +778,7 @@
}
}
UPB_INLINE const upb_Array* _grpc_gcp_ServerHandshakeParameters_record_protocols_upb_array(const grpc_gcp_ServerHandshakeParameters* msg, size_t* size) {
- const upb_MiniTableField field = {1, 8, 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {1, UPB_SIZE(8, 24), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
if (size) {
*size = arr ? arr->UPB_PRIVATE(size) : 0;
@@ -770,7 +786,7 @@
return arr;
}
UPB_INLINE upb_Array* _grpc_gcp_ServerHandshakeParameters_record_protocols_mutable_upb_array(grpc_gcp_ServerHandshakeParameters* msg, size_t* size, upb_Arena* arena) {
- const upb_MiniTableField field = {1, 8, 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {1, UPB_SIZE(8, 24), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
&field, arena);
if (size) {
@@ -779,11 +795,11 @@
return arr;
}
UPB_INLINE void grpc_gcp_ServerHandshakeParameters_clear_local_identities(grpc_gcp_ServerHandshakeParameters* msg) {
- const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
}
UPB_INLINE const grpc_gcp_Identity* const* grpc_gcp_ServerHandshakeParameters_local_identities(const grpc_gcp_ServerHandshakeParameters* msg, size_t* size) {
- const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__Identity_msg_init);
const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
if (arr) {
@@ -795,7 +811,7 @@
}
}
UPB_INLINE const upb_Array* _grpc_gcp_ServerHandshakeParameters_local_identities_upb_array(const grpc_gcp_ServerHandshakeParameters* msg, size_t* size) {
- const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__Identity_msg_init);
const upb_Array* arr = upb_Message_GetArray(UPB_UPCAST(msg), &field);
if (size) {
@@ -804,7 +820,7 @@
return arr;
}
UPB_INLINE upb_Array* _grpc_gcp_ServerHandshakeParameters_local_identities_mutable_upb_array(grpc_gcp_ServerHandshakeParameters* msg, size_t* size, upb_Arena* arena) {
- const upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ const upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__Identity_msg_init);
upb_Array* arr = upb_Message_GetOrCreateMutableArray(UPB_UPCAST(msg),
&field, arena);
@@ -813,9 +829,21 @@
}
return arr;
}
+UPB_INLINE void grpc_gcp_ServerHandshakeParameters_clear_token(grpc_gcp_ServerHandshakeParameters* msg) {
+ const upb_MiniTableField field = {3, UPB_SIZE(16, 8), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
+ upb_Message_ClearBaseField(UPB_UPCAST(msg), &field);
+}
+UPB_INLINE upb_StringView grpc_gcp_ServerHandshakeParameters_token(const grpc_gcp_ServerHandshakeParameters* msg) {
+ upb_StringView default_val = upb_StringView_FromString("");
+ upb_StringView ret;
+ const upb_MiniTableField field = {3, UPB_SIZE(16, 8), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
+ _upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field,
+ &default_val, &ret);
+ return ret;
+}
UPB_INLINE upb_StringView* grpc_gcp_ServerHandshakeParameters_mutable_record_protocols(grpc_gcp_ServerHandshakeParameters* msg, size_t* size) {
- upb_MiniTableField field = {1, 8, 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ upb_MiniTableField field = {1, UPB_SIZE(8, 24), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
if (arr) {
if (size) *size = arr->UPB_PRIVATE(size);
@@ -826,12 +854,12 @@
}
}
UPB_INLINE upb_StringView* grpc_gcp_ServerHandshakeParameters_resize_record_protocols(grpc_gcp_ServerHandshakeParameters* msg, size_t size, upb_Arena* arena) {
- upb_MiniTableField field = {1, 8, 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ upb_MiniTableField field = {1, UPB_SIZE(8, 24), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
return (upb_StringView*)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
&field, size, arena);
}
UPB_INLINE bool grpc_gcp_ServerHandshakeParameters_add_record_protocols(grpc_gcp_ServerHandshakeParameters* msg, upb_StringView val, upb_Arena* arena) {
- upb_MiniTableField field = {1, 8, 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ upb_MiniTableField field = {1, UPB_SIZE(8, 24), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
upb_Array* arr = upb_Message_GetOrCreateMutableArray(
UPB_UPCAST(msg), &field, arena);
if (!arr || !UPB_PRIVATE(_upb_Array_ResizeUninitialized)(
@@ -843,7 +871,7 @@
return true;
}
UPB_INLINE grpc_gcp_Identity** grpc_gcp_ServerHandshakeParameters_mutable_local_identities(grpc_gcp_ServerHandshakeParameters* msg, size_t* size) {
- upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__Identity_msg_init);
upb_Array* arr = upb_Message_GetMutableArray(UPB_UPCAST(msg), &field);
if (arr) {
@@ -855,12 +883,12 @@
}
}
UPB_INLINE grpc_gcp_Identity** grpc_gcp_ServerHandshakeParameters_resize_local_identities(grpc_gcp_ServerHandshakeParameters* msg, size_t size, upb_Arena* arena) {
- upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
return (grpc_gcp_Identity**)upb_Message_ResizeArrayUninitialized(UPB_UPCAST(msg),
&field, size, arena);
}
UPB_INLINE struct grpc_gcp_Identity* grpc_gcp_ServerHandshakeParameters_add_local_identities(grpc_gcp_ServerHandshakeParameters* msg, upb_Arena* arena) {
- upb_MiniTableField field = {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
+ upb_MiniTableField field = {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)};
UPB_PRIVATE(_upb_MiniTable_StrongReference)(&grpc__gcp__Identity_msg_init);
upb_Array* arr = upb_Message_GetOrCreateMutableArray(
UPB_UPCAST(msg), &field, arena);
@@ -874,6 +902,10 @@
(arr, arr->UPB_PRIVATE(size) - 1, &sub, sizeof(sub));
return sub;
}
+UPB_INLINE void grpc_gcp_ServerHandshakeParameters_set_token(grpc_gcp_ServerHandshakeParameters *msg, upb_StringView value) {
+ const upb_MiniTableField field = {3, UPB_SIZE(16, 8), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)};
+ upb_Message_SetBaseField((upb_Message *)msg, &field, &value);
+}
/* grpc.gcp.StartServerHandshakeReq */
diff --git a/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb_minitable.c b/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb_minitable.c
index c8a06a9..c393248 100644
--- a/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb_minitable.c
+++ b/src/core/ext/upb-gen/src/proto/grpc/gcp/handshaker.upb_minitable.c
@@ -93,40 +93,41 @@
{.UPB_PRIVATE(submsg) = &grpc__gcp__TransportProtocolPreferences_msg_init_ptr},
};
-static const upb_MiniTableField grpc_gcp_StartClientHandshakeReq__fields[11] = {
+static const upb_MiniTableField grpc_gcp_StartClientHandshakeReq__fields[12] = {
{1, 12, 0, kUpb_NoSub, 5, (int)kUpb_FieldMode_Scalar | (int)kUpb_LabelFlags_IsAlternate | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
- {2, UPB_SIZE(16, 40), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
- {3, UPB_SIZE(20, 48), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
- {4, UPB_SIZE(24, 56), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
- {5, UPB_SIZE(28, 64), 64, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
- {6, UPB_SIZE(32, 72), 65, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
- {7, UPB_SIZE(36, 80), 66, 3, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
+ {2, UPB_SIZE(16, 56), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
+ {3, UPB_SIZE(20, 64), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
+ {4, UPB_SIZE(24, 72), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
+ {5, UPB_SIZE(28, 80), 64, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
+ {6, UPB_SIZE(32, 88), 65, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
+ {7, UPB_SIZE(36, 96), 66, 3, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
{8, UPB_SIZE(52, 24), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
- {9, UPB_SIZE(40, 88), 67, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
+ {9, UPB_SIZE(40, 104), 67, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
{10, UPB_SIZE(44, 16), 0, kUpb_NoSub, 13, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_4Byte << kUpb_FieldRep_Shift)},
- {12, UPB_SIZE(48, 96), 68, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
+ {11, UPB_SIZE(60, 40), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
+ {12, UPB_SIZE(48, 112), 68, 5, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
};
const upb_MiniTable grpc__gcp__StartClientHandshakeReq_msg_init = {
&grpc_gcp_StartClientHandshakeReq__submsgs[0],
&grpc_gcp_StartClientHandshakeReq__fields[0],
- UPB_SIZE(64, 104), 11, kUpb_ExtMode_NonExtendable, 10, UPB_FASTTABLE_MASK(120), 0,
+ UPB_SIZE(72, 120), 12, kUpb_ExtMode_NonExtendable, 12, UPB_FASTTABLE_MASK(120), 0,
#ifdef UPB_TRACING_ENABLED
"grpc.gcp.StartClientHandshakeReq",
#endif
UPB_FASTTABLE_INIT({
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
{0x000c00003f000008, &upb_psv4_1bt},
- {0x002800003f000012, &upb_prs_1bt},
- {0x003000003f00001a, &upb_prs_1bt},
- {0x003800003f000022, &upb_prm_1bt_max64b},
+ {0x003800003f000012, &upb_prs_1bt},
+ {0x004000003f00001a, &upb_prs_1bt},
+ {0x004800003f000022, &upb_prm_1bt_max64b},
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
{0x001800003f000042, &upb_pss_1bt},
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
{0x001000003f000050, &upb_psv4_1bt},
- {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
+ {0x002800003f00005a, &upb_pss_1bt},
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
@@ -139,23 +140,24 @@
{.UPB_PRIVATE(submsg) = &grpc__gcp__Identity_msg_init_ptr},
};
-static const upb_MiniTableField grpc_gcp_ServerHandshakeParameters__fields[2] = {
- {1, 8, 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
- {2, UPB_SIZE(12, 16), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
+static const upb_MiniTableField grpc_gcp_ServerHandshakeParameters__fields[3] = {
+ {1, UPB_SIZE(8, 24), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
+ {2, UPB_SIZE(12, 32), 0, 0, 11, (int)kUpb_FieldMode_Array | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)},
+ {3, UPB_SIZE(16, 8), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)},
};
const upb_MiniTable grpc__gcp__ServerHandshakeParameters_msg_init = {
&grpc_gcp_ServerHandshakeParameters__submsgs[0],
&grpc_gcp_ServerHandshakeParameters__fields[0],
- UPB_SIZE(16, 24), 2, kUpb_ExtMode_NonExtendable, 2, UPB_FASTTABLE_MASK(24), 0,
+ UPB_SIZE(24, 40), 3, kUpb_ExtMode_NonExtendable, 3, UPB_FASTTABLE_MASK(24), 0,
#ifdef UPB_TRACING_ENABLED
"grpc.gcp.ServerHandshakeParameters",
#endif
UPB_FASTTABLE_INIT({
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
- {0x000800003f00000a, &upb_prs_1bt},
- {0x001000003f000012, &upb_prm_1bt_max64b},
- {0x0000000000000000, &_upb_FastDecoder_DecodeGeneric},
+ {0x001800003f00000a, &upb_prs_1bt},
+ {0x002000003f000012, &upb_prm_1bt_max64b},
+ {0x000800003f00001a, &upb_pss_1bt},
})
};
diff --git a/src/core/tsi/alts/handshaker/alts_handshaker_client.cc b/src/core/tsi/alts/handshaker/alts_handshaker_client.cc
index 53c93ee..feab51d 100644
--- a/src/core/tsi/alts/handshaker/alts_handshaker_client.cc
+++ b/src/core/tsi/alts/handshaker/alts_handshaker_client.cc
@@ -23,18 +23,17 @@
#include <grpc/support/port_platform.h>
#include <list>
+#include <memory>
+#include <string>
#include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/numbers.h"
#include "absl/strings/str_split.h"
-#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/call.h"
#include "src/core/lib/surface/channel.h"
-#include "src/core/tsi/alts/handshaker/alts_shared_resource.h"
#include "src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h"
#include "src/core/tsi/alts/handshaker/alts_tsi_utils.h"
-#include "src/core/util/crash.h"
#include "src/core/util/env.h"
#include "src/core/util/sync.h"
#include "upb/mem/arena.hpp"
@@ -536,6 +535,24 @@
upb_StringView_FromString(ptr->data));
ptr = ptr->next;
}
+ // This ensures the token string is available when the proto gets serialized.
+ absl::StatusOr<std::string> access_token = absl::NotFoundError("");
+ // Set access token if the token fetcher is available.
+ grpc::alts::TokenFetcher* token_fetcher =
+ (reinterpret_cast<grpc_alts_credentials_client_options*>(client->options))
+ ->token_fetcher.get();
+ if (token_fetcher != nullptr) {
+ access_token = token_fetcher->GetToken();
+ if (!access_token.ok()) {
+ LOG_EVERY_N_SEC(ERROR, 60)
+ << "Failed to get token from the token fetcher "
+ "in client start handshake: "
+ << access_token.status();
+ return nullptr;
+ }
+ grpc_gcp_StartClientHandshakeReq_set_access_token(
+ start_client, upb_StringView_FromString(access_token->c_str()));
+ }
grpc_gcp_StartClientHandshakeReq_set_max_frame_size(
start_client, static_cast<uint32_t>(client->max_frame_size));
if (!client->preferred_transport_protocols.empty()) {
diff --git a/src/proto/grpc/gcp/handshaker.proto b/src/proto/grpc/gcp/handshaker.proto
index 80150a4..30c0a6b 100644
--- a/src/proto/grpc/gcp/handshaker.proto
+++ b/src/proto/grpc/gcp/handshaker.proto
@@ -109,6 +109,9 @@
// (Optional) Maximum frame size supported by the client.
uint32 max_frame_size = 10;
+ // (Optional) Internal use only.
+ string access_token = 11;
+
// (Optional) Ordered transport protocol preferences supported by the client.
TransportProtocolPreferences transport_protocol_preferences = 12;
}
@@ -121,6 +124,9 @@
// (Optional) A list of local identities supported by the server, if
// specified. Otherwise, the handshaker chooses a default local identity.
repeated Identity local_identities = 2;
+
+ // (Optional) Internal use only.
+ string token = 3;
}
message StartServerHandshakeReq {
diff --git a/test/core/credentials/transport/alts/grpc_alts_credentials_options_test.cc b/test/core/credentials/transport/alts/grpc_alts_credentials_options_test.cc
index da5600c..ac4cf79 100644
--- a/test/core/credentials/transport/alts/grpc_alts_credentials_options_test.cc
+++ b/test/core/credentials/transport/alts/grpc_alts_credentials_options_test.cc
@@ -23,14 +23,27 @@
#include <stdlib.h>
#include <string.h>
+#include <memory>
+
#include "gtest/gtest.h"
#include "src/core/util/crash.h"
#define ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_1 "abc@google.com"
#define ALTS_CLIENT_OPTIONS_TEST_TARGET_SERVICE_ACCOUNT_2 "def@google.com"
+namespace {
+
const size_t kTargetServiceAccountNum = 2;
+class FakeTokenFetcher final : public grpc::alts::TokenFetcher {
+ public:
+ ~FakeTokenFetcher() override = default;
+
+ absl::StatusOr<std::string> GetToken() override { return "fake_token"; }
+};
+
+} // namespace
+
TEST(GrpcAltsCredentialsOptionsTest, CopyClientOptionsFailure) {
// Initialization.
grpc_alts_credentials_options* options =
@@ -87,6 +100,24 @@
grpc_alts_credentials_options_destroy(new_options);
}
+TEST(GrpcAltsCredentialsOptionsTest, ClientOptionsWithTokenFetcher) {
+ // Initialization.
+ grpc_alts_credentials_options* options =
+ grpc_alts_credentials_client_options_create();
+
+ // Set the token fetcher and check success.
+ std::shared_ptr<FakeTokenFetcher> token_fetcher =
+ std::make_shared<FakeTokenFetcher>();
+ grpc_alts_credentials_client_options_set_token_fetcher(options,
+ token_fetcher);
+ auto client_options =
+ reinterpret_cast<grpc_alts_credentials_client_options*>(options);
+ ASSERT_NE(client_options->token_fetcher, nullptr);
+
+ // Cleanup.
+ grpc_alts_credentials_options_destroy(options);
+}
+
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
diff --git a/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc b/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc
index 7306aa7..62b3aef 100644
--- a/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc
+++ b/test/core/tsi/alts/handshaker/alts_handshaker_client_test.cc
@@ -22,6 +22,8 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
+#include <memory>
+
#include "gtest/gtest.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/tsi/alts/handshaker/alts_shared_resource.h"
@@ -30,6 +32,7 @@
#include "src/core/tsi/transport_security.h"
#include "src/core/tsi/transport_security_interface.h"
#include "src/core/util/env.h"
+#include "src/proto/grpc/gcp/handshaker.upb.h"
#include "test/core/test_util/test_config.h"
#include "test/core/tsi/alts/handshaker/alts_handshaker_service_api_test_lib.h"
#include "upb/mem/arena.hpp"
@@ -49,6 +52,7 @@
const size_t kMaxRpcVersionMinor = 2;
const size_t kMinRpcVersionMajor = 2;
const size_t kMinRpcVersionMinor = 1;
+const char kFakeToken[] = "fake_token";
using grpc_core::internal::alts_handshaker_client_get_closure_for_testing;
using grpc_core::internal::
@@ -169,7 +173,8 @@
/// record_protocol and max_frame_size, and op is correctly populated.
///
grpc_call_error CheckClientStartSuccess(grpc_call* /*call*/, const grpc_op* op,
- size_t nops, grpc_closure* closure) {
+ size_t nops, grpc_closure* closure,
+ bool has_token) {
// RECV_STATUS ops are asserted to always succeed
if (IsRecvStatusOp(op, nops)) {
return GRPC_CALL_OK;
@@ -208,10 +213,28 @@
upb_StringView_FromString(ALTS_HANDSHAKER_CLIENT_TEST_TARGET_NAME)));
EXPECT_EQ(grpc_gcp_StartClientHandshakeReq_max_frame_size(client_start),
ALTS_HANDSHAKER_CLIENT_TEST_MAX_FRAME_SIZE);
+ if (has_token) {
+ EXPECT_TRUE(upb_StringView_IsEqual(
+ grpc_gcp_StartClientHandshakeReq_access_token(client_start),
+ upb_StringView_FromString(kFakeToken)));
+ }
EXPECT_TRUE(ValidateOp(client, op, nops, true /* is_start */));
return GRPC_CALL_OK;
}
+grpc_call_error CheckClientStartSuccessWithToken(grpc_call* call,
+ const grpc_op* op, size_t nops,
+ grpc_closure* closure) {
+ return CheckClientStartSuccess(call, op, nops, closure, /*has_token=*/true);
+}
+
+grpc_call_error CheckClientStartSuccessWithoutToken(grpc_call* call,
+ const grpc_op* op,
+ size_t nops,
+ grpc_closure* closure) {
+ return CheckClientStartSuccess(call, op, nops, closure, /*has_token=*/false);
+}
+
void VerifyTransportProtocolPreferences(
const grpc_gcp_TransportProtocolPreferences* protocol_preferences,
bool is_server) {
@@ -253,7 +276,7 @@
grpc_gcp_StartClientHandshakeReq_transport_protocol_preferences(
client_start),
/*is_server=*/false);
- return CheckClientStartSuccess(nullptr, op, nops, closure);
+ return CheckClientStartSuccessWithoutToken(nullptr, op, nops, closure);
}
///
@@ -377,7 +400,8 @@
return options;
}
-alts_handshaker_client_test_config* CreateConfig() {
+alts_handshaker_client_test_config* CreateConfig(
+ std::shared_ptr<grpc::alts::TokenFetcher> token_fetcher = nullptr) {
alts_handshaker_client_test_config* config =
static_cast<alts_handshaker_client_test_config*>(
gpr_zalloc(sizeof(*config)));
@@ -388,6 +412,10 @@
config->cq = grpc_completion_queue_create_for_next(nullptr);
grpc_alts_credentials_options* client_options =
CreateCredentialsOptions(true /* is_client */);
+ if (token_fetcher != nullptr) {
+ grpc_alts_credentials_client_options_set_token_fetcher(client_options,
+ token_fetcher);
+ }
grpc_alts_credentials_options* server_options =
CreateCredentialsOptions(false /* is_client */);
config->server = alts_grpc_handshaker_client_create(
@@ -425,6 +453,23 @@
gpr_free(config);
}
+class FakeTokenFetcher : public grpc::alts::TokenFetcher {
+ public:
+ explicit FakeTokenFetcher(absl::Status error = absl::OkStatus())
+ : error_(std::move(error)) {}
+ ~FakeTokenFetcher() override = default;
+
+ absl::StatusOr<std::string> GetToken() override {
+ if (!error_.ok()) {
+ return error_;
+ }
+ return kFakeToken;
+ }
+
+ private:
+ absl::Status error_;
+};
+
} // namespace
TEST(AltsHandshakerClientTest, ScheduleRequestInvalidArgTest) {
@@ -471,8 +516,61 @@
// Initialization.
alts_handshaker_client_test_config* config = CreateConfig();
// Check client_start success.
+ alts_handshaker_client_set_grpc_caller_for_testing(
+ config->client, CheckClientStartSuccessWithoutToken);
+ {
+ grpc_core::ExecCtx exec_ctx;
+ ASSERT_EQ(alts_handshaker_client_start_client(config->client), TSI_OK);
+ }
+ {
+ grpc_core::ExecCtx exec_ctx;
+ ASSERT_EQ(alts_handshaker_client_next(nullptr, &config->out_frame),
+ TSI_INVALID_ARGUMENT);
+ }
+ // Check server_start success.
+ alts_handshaker_client_set_grpc_caller_for_testing(config->server,
+ CheckServerStartSuccess);
+ {
+ grpc_core::ExecCtx exec_ctx;
+ ASSERT_EQ(
+ alts_handshaker_client_start_server(config->server, &config->out_frame),
+ TSI_OK);
+ }
+ // Check client next success.
alts_handshaker_client_set_grpc_caller_for_testing(config->client,
- CheckClientStartSuccess);
+ CheckNextSuccess);
+ {
+ grpc_core::ExecCtx exec_ctx;
+ ASSERT_EQ(alts_handshaker_client_next(config->client, &config->out_frame),
+ TSI_OK);
+ }
+ // Check server next success.
+ alts_handshaker_client_set_grpc_caller_for_testing(config->server,
+ CheckNextSuccess);
+ {
+ grpc_core::ExecCtx exec_ctx;
+ ASSERT_EQ(alts_handshaker_client_next(config->server, &config->out_frame),
+ TSI_OK);
+ }
+ // Cleanup.
+ {
+ grpc_core::ExecCtx exec_ctx;
+ alts_handshaker_client_on_status_received_for_testing(
+ config->client, GRPC_STATUS_OK, absl::OkStatus());
+ alts_handshaker_client_on_status_received_for_testing(
+ config->server, GRPC_STATUS_OK, absl::OkStatus());
+ }
+ DestroyConfig(config);
+}
+
+TEST(AltsHandshakerClientTest, ScheduleRequestWithTokenSuccessTest) {
+ // Initialization.
+ std::shared_ptr<FakeTokenFetcher> token_fetcher =
+ std::make_shared<FakeTokenFetcher>();
+ alts_handshaker_client_test_config* config = CreateConfig(token_fetcher);
+ // Check client_start success.
+ alts_handshaker_client_set_grpc_caller_for_testing(
+ config->client, CheckClientStartSuccessWithToken);
{
grpc_core::ExecCtx exec_ctx;
ASSERT_EQ(alts_handshaker_client_start_client(config->client), TSI_OK);
@@ -577,6 +675,27 @@
ASSERT_EQ(status, TSI_INTERNAL_ERROR);
}
+TEST(AltsHandshakerClientTest, ScheduleRequestWithTokenFailureTest) {
+ // Initialization.
+ std::shared_ptr<FakeTokenFetcher> token_fetcher =
+ std::make_shared<FakeTokenFetcher>(
+ absl::InternalError("failed to get a token"));
+ alts_handshaker_client_test_config* config = CreateConfig(token_fetcher);
+ // Check client_start failure.
+ alts_handshaker_client_set_grpc_caller_for_testing(config->client,
+ CheckGrpcCallFailure);
+ {
+ grpc_core::ExecCtx exec_ctx;
+ // TODO(apolcyn): go back to asserting TSI_INTERNAL_ERROR as return
+ // value instead of callback status, after removing the global
+ // queue in https://github.com/grpc/grpc/pull/20722
+ alts_handshaker_client_set_cb_for_testing(config->client,
+ tsi_cb_assert_tsi_internal_error);
+ alts_handshaker_client_start_client(config->client);
+ }
+ DestroyConfig(config);
+}
+
TEST(AltsHandshakerClientTest, ScheduleRequestGrpcCallFailureTest) {
// Initialization.
alts_handshaker_client_test_config* config = CreateConfig();