mirror of https://github.com/grpc/grpc.git
[xDS] validate Audience cluster metadata (#37566)
Add validation of the `Audience` cluster metadata type, as per gRFC A83 (https://github.com/grpc/proposal/pull/438). I had previously changed the metadata to be represented as JSON in #37468. However, while working on the GCP Authentication filter implementation, I realized that that's not an ideal representation, because it would have required us to validate the JSON on a per-RPC basis, which would be bad for performance. So I've changed the representation of metadata to be an abstract type, and we now store the `Audience` metadata as a simple string. I've also moved metadata into its own type with its own validation code, so that in the future we can use it in places other than CDS (many xDS resource types have metadata fields). While I was at it, I also add some helper functions for validating the `UInt32Value` and `UInt64Value` wrapper protos. Closes #37566 PiperOrigin-RevId: 668281729pull/37587/head
parent
8260e319a4
commit
ae5dfa13e8
48 changed files with 1897 additions and 281 deletions
@ -0,0 +1,431 @@ |
||||
/* This file was generated by upb_generator from the input file:
|
||||
* |
||||
* envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.proto |
||||
* |
||||
* Do not edit -- your changes will be discarded when the file is |
||||
* regenerated. */ |
||||
|
||||
#ifndef ENVOY_EXTENSIONS_FILTERS_HTTP_GCP_AUTHN_V3_GCP_AUTHN_PROTO_UPB_H_ |
||||
#define ENVOY_EXTENSIONS_FILTERS_HTTP_GCP_AUTHN_V3_GCP_AUTHN_PROTO_UPB_H_ |
||||
|
||||
#include "upb/generated_code_support.h" |
||||
|
||||
#include "envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.h" |
||||
|
||||
#include "envoy/config/core/v3/base.upb_minitable.h" |
||||
#include "envoy/config/core/v3/http_uri.upb_minitable.h" |
||||
#include "google/protobuf/duration.upb_minitable.h" |
||||
#include "google/protobuf/wrappers.upb_minitable.h" |
||||
#include "envoy/annotations/deprecation.upb_minitable.h" |
||||
#include "udpa/annotations/status.upb_minitable.h" |
||||
#include "validate/validate.upb_minitable.h" |
||||
|
||||
// Must be last.
|
||||
#include "upb/port/def.inc" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
typedef struct envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig { upb_Message UPB_PRIVATE(base); } envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig; |
||||
typedef struct envoy_extensions_filters_http_gcp_authn_v3_Audience { upb_Message UPB_PRIVATE(base); } envoy_extensions_filters_http_gcp_authn_v3_Audience; |
||||
typedef struct envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig { upb_Message UPB_PRIVATE(base); } envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig; |
||||
typedef struct envoy_extensions_filters_http_gcp_authn_v3_TokenHeader { upb_Message UPB_PRIVATE(base); } envoy_extensions_filters_http_gcp_authn_v3_TokenHeader; |
||||
struct envoy_config_core_v3_HttpUri; |
||||
struct envoy_config_core_v3_RetryPolicy; |
||||
struct google_protobuf_Duration; |
||||
struct google_protobuf_UInt64Value; |
||||
|
||||
|
||||
|
||||
/* envoy.extensions.filters.http.gcp_authn.v3.GcpAuthnFilterConfig */ |
||||
|
||||
UPB_INLINE envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_new(upb_Arena* arena) { |
||||
return (envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig*)_upb_Message_New(&envoy__extensions__filters__http__gcp_0authn__v3__GcpAuthnFilterConfig_msg_init, arena); |
||||
} |
||||
UPB_INLINE envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_parse(const char* buf, size_t size, upb_Arena* arena) { |
||||
envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* ret = envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_new(arena); |
||||
if (!ret) return NULL; |
||||
if (upb_Decode(buf, size, UPB_UPCAST(ret), &envoy__extensions__filters__http__gcp_0authn__v3__GcpAuthnFilterConfig_msg_init, NULL, 0, arena) != |
||||
kUpb_DecodeStatus_Ok) { |
||||
return NULL; |
||||
} |
||||
return ret; |
||||
} |
||||
UPB_INLINE envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_parse_ex(const char* buf, size_t size, |
||||
const upb_ExtensionRegistry* extreg, |
||||
int options, upb_Arena* arena) { |
||||
envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* ret = envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_new(arena); |
||||
if (!ret) return NULL; |
||||
if (upb_Decode(buf, size, UPB_UPCAST(ret), &envoy__extensions__filters__http__gcp_0authn__v3__GcpAuthnFilterConfig_msg_init, extreg, options, |
||||
arena) != kUpb_DecodeStatus_Ok) { |
||||
return NULL; |
||||
} |
||||
return ret; |
||||
} |
||||
UPB_INLINE char* envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_serialize(const envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg, upb_Arena* arena, size_t* len) { |
||||
char* ptr; |
||||
(void)upb_Encode(UPB_UPCAST(msg), &envoy__extensions__filters__http__gcp_0authn__v3__GcpAuthnFilterConfig_msg_init, 0, arena, &ptr, len); |
||||
return ptr; |
||||
} |
||||
UPB_INLINE char* envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_serialize_ex(const envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg, int options, |
||||
upb_Arena* arena, size_t* len) { |
||||
char* ptr; |
||||
(void)upb_Encode(UPB_UPCAST(msg), &envoy__extensions__filters__http__gcp_0authn__v3__GcpAuthnFilterConfig_msg_init, options, arena, &ptr, len); |
||||
return ptr; |
||||
} |
||||
UPB_INLINE void envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_clear_http_uri(envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg) { |
||||
const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 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 envoy_config_core_v3_HttpUri* envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_http_uri(const envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg) { |
||||
const struct envoy_config_core_v3_HttpUri* default_val = NULL; |
||||
const struct envoy_config_core_v3_HttpUri* ret; |
||||
const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
||||
_upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, |
||||
&default_val, &ret); |
||||
return ret; |
||||
} |
||||
UPB_INLINE bool envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_has_http_uri(const envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg) { |
||||
const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 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 envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_clear_retry_policy(envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg) { |
||||
const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 65, 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 struct envoy_config_core_v3_RetryPolicy* envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_retry_policy(const envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg) { |
||||
const struct envoy_config_core_v3_RetryPolicy* default_val = NULL; |
||||
const struct envoy_config_core_v3_RetryPolicy* ret; |
||||
const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
||||
_upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, |
||||
&default_val, &ret); |
||||
return ret; |
||||
} |
||||
UPB_INLINE bool envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_has_retry_policy(const envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg) { |
||||
const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 65, 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 envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_clear_cache_config(envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg) { |
||||
const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 66, 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 envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig* envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_cache_config(const envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg) { |
||||
const envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig* default_val = NULL; |
||||
const envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig* ret; |
||||
const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 66, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
||||
_upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, |
||||
&default_val, &ret); |
||||
return ret; |
||||
} |
||||
UPB_INLINE bool envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_has_cache_config(const envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg) { |
||||
const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 66, 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 envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_clear_token_header(envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg) { |
||||
const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 67, 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 envoy_extensions_filters_http_gcp_authn_v3_TokenHeader* envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_token_header(const envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg) { |
||||
const envoy_extensions_filters_http_gcp_authn_v3_TokenHeader* default_val = NULL; |
||||
const envoy_extensions_filters_http_gcp_authn_v3_TokenHeader* ret; |
||||
const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 67, 3, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
||||
_upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, |
||||
&default_val, &ret); |
||||
return ret; |
||||
} |
||||
UPB_INLINE bool envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_has_token_header(const envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg) { |
||||
const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 67, 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 envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_clear_cluster(envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg) { |
||||
const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 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 envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_cluster(const envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg) { |
||||
upb_StringView default_val = upb_StringView_FromString(""); |
||||
upb_StringView ret; |
||||
const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 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 envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_clear_timeout(envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg) { |
||||
const upb_MiniTableField field = {6, UPB_SIZE(28, 64), 68, 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 google_protobuf_Duration* envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_timeout(const envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg) { |
||||
const struct google_protobuf_Duration* default_val = NULL; |
||||
const struct google_protobuf_Duration* ret; |
||||
const upb_MiniTableField field = {6, UPB_SIZE(28, 64), 68, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
||||
_upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, |
||||
&default_val, &ret); |
||||
return ret; |
||||
} |
||||
UPB_INLINE bool envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_has_timeout(const envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg) { |
||||
const upb_MiniTableField field = {6, UPB_SIZE(28, 64), 68, 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 envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_set_http_uri(envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig *msg, struct envoy_config_core_v3_HttpUri* value) { |
||||
const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
||||
upb_Message_SetBaseField((upb_Message *)msg, &field, &value); |
||||
} |
||||
UPB_INLINE struct envoy_config_core_v3_HttpUri* envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_mutable_http_uri(envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg, upb_Arena* arena) { |
||||
struct envoy_config_core_v3_HttpUri* sub = (struct envoy_config_core_v3_HttpUri*)envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_http_uri(msg); |
||||
if (sub == NULL) { |
||||
sub = (struct envoy_config_core_v3_HttpUri*)_upb_Message_New(&envoy__config__core__v3__HttpUri_msg_init, arena); |
||||
if (sub) envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_set_http_uri(msg, sub); |
||||
} |
||||
return sub; |
||||
} |
||||
UPB_INLINE void envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_set_retry_policy(envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig *msg, struct envoy_config_core_v3_RetryPolicy* value) { |
||||
const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
||||
upb_Message_SetBaseField((upb_Message *)msg, &field, &value); |
||||
} |
||||
UPB_INLINE struct envoy_config_core_v3_RetryPolicy* envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_mutable_retry_policy(envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg, upb_Arena* arena) { |
||||
struct envoy_config_core_v3_RetryPolicy* sub = (struct envoy_config_core_v3_RetryPolicy*)envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_retry_policy(msg); |
||||
if (sub == NULL) { |
||||
sub = (struct envoy_config_core_v3_RetryPolicy*)_upb_Message_New(&envoy__config__core__v3__RetryPolicy_msg_init, arena); |
||||
if (sub) envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_set_retry_policy(msg, sub); |
||||
} |
||||
return sub; |
||||
} |
||||
UPB_INLINE void envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_set_cache_config(envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig *msg, envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig* value) { |
||||
const upb_MiniTableField field = {3, UPB_SIZE(20, 32), 66, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
||||
upb_Message_SetBaseField((upb_Message *)msg, &field, &value); |
||||
} |
||||
UPB_INLINE struct envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig* envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_mutable_cache_config(envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg, upb_Arena* arena) { |
||||
struct envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig* sub = (struct envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig*)envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_cache_config(msg); |
||||
if (sub == NULL) { |
||||
sub = (struct envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig*)_upb_Message_New(&envoy__extensions__filters__http__gcp_0authn__v3__TokenCacheConfig_msg_init, arena); |
||||
if (sub) envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_set_cache_config(msg, sub); |
||||
} |
||||
return sub; |
||||
} |
||||
UPB_INLINE void envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_set_token_header(envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig *msg, envoy_extensions_filters_http_gcp_authn_v3_TokenHeader* value) { |
||||
const upb_MiniTableField field = {4, UPB_SIZE(24, 40), 67, 3, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
||||
upb_Message_SetBaseField((upb_Message *)msg, &field, &value); |
||||
} |
||||
UPB_INLINE struct envoy_extensions_filters_http_gcp_authn_v3_TokenHeader* envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_mutable_token_header(envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg, upb_Arena* arena) { |
||||
struct envoy_extensions_filters_http_gcp_authn_v3_TokenHeader* sub = (struct envoy_extensions_filters_http_gcp_authn_v3_TokenHeader*)envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_token_header(msg); |
||||
if (sub == NULL) { |
||||
sub = (struct envoy_extensions_filters_http_gcp_authn_v3_TokenHeader*)_upb_Message_New(&envoy__extensions__filters__http__gcp_0authn__v3__TokenHeader_msg_init, arena); |
||||
if (sub) envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_set_token_header(msg, sub); |
||||
} |
||||
return sub; |
||||
} |
||||
UPB_INLINE void envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_set_cluster(envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig *msg, upb_StringView value) { |
||||
const upb_MiniTableField field = {5, UPB_SIZE(32, 48), 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 envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_set_timeout(envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig *msg, struct google_protobuf_Duration* value) { |
||||
const upb_MiniTableField field = {6, UPB_SIZE(28, 64), 68, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
||||
upb_Message_SetBaseField((upb_Message *)msg, &field, &value); |
||||
} |
||||
UPB_INLINE struct google_protobuf_Duration* envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_mutable_timeout(envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig* msg, upb_Arena* arena) { |
||||
struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_timeout(msg); |
||||
if (sub == NULL) { |
||||
sub = (struct google_protobuf_Duration*)_upb_Message_New(&google__protobuf__Duration_msg_init, arena); |
||||
if (sub) envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_set_timeout(msg, sub); |
||||
} |
||||
return sub; |
||||
} |
||||
|
||||
/* envoy.extensions.filters.http.gcp_authn.v3.Audience */ |
||||
|
||||
UPB_INLINE envoy_extensions_filters_http_gcp_authn_v3_Audience* envoy_extensions_filters_http_gcp_authn_v3_Audience_new(upb_Arena* arena) { |
||||
return (envoy_extensions_filters_http_gcp_authn_v3_Audience*)_upb_Message_New(&envoy__extensions__filters__http__gcp_0authn__v3__Audience_msg_init, arena); |
||||
} |
||||
UPB_INLINE envoy_extensions_filters_http_gcp_authn_v3_Audience* envoy_extensions_filters_http_gcp_authn_v3_Audience_parse(const char* buf, size_t size, upb_Arena* arena) { |
||||
envoy_extensions_filters_http_gcp_authn_v3_Audience* ret = envoy_extensions_filters_http_gcp_authn_v3_Audience_new(arena); |
||||
if (!ret) return NULL; |
||||
if (upb_Decode(buf, size, UPB_UPCAST(ret), &envoy__extensions__filters__http__gcp_0authn__v3__Audience_msg_init, NULL, 0, arena) != |
||||
kUpb_DecodeStatus_Ok) { |
||||
return NULL; |
||||
} |
||||
return ret; |
||||
} |
||||
UPB_INLINE envoy_extensions_filters_http_gcp_authn_v3_Audience* envoy_extensions_filters_http_gcp_authn_v3_Audience_parse_ex(const char* buf, size_t size, |
||||
const upb_ExtensionRegistry* extreg, |
||||
int options, upb_Arena* arena) { |
||||
envoy_extensions_filters_http_gcp_authn_v3_Audience* ret = envoy_extensions_filters_http_gcp_authn_v3_Audience_new(arena); |
||||
if (!ret) return NULL; |
||||
if (upb_Decode(buf, size, UPB_UPCAST(ret), &envoy__extensions__filters__http__gcp_0authn__v3__Audience_msg_init, extreg, options, |
||||
arena) != kUpb_DecodeStatus_Ok) { |
||||
return NULL; |
||||
} |
||||
return ret; |
||||
} |
||||
UPB_INLINE char* envoy_extensions_filters_http_gcp_authn_v3_Audience_serialize(const envoy_extensions_filters_http_gcp_authn_v3_Audience* msg, upb_Arena* arena, size_t* len) { |
||||
char* ptr; |
||||
(void)upb_Encode(UPB_UPCAST(msg), &envoy__extensions__filters__http__gcp_0authn__v3__Audience_msg_init, 0, arena, &ptr, len); |
||||
return ptr; |
||||
} |
||||
UPB_INLINE char* envoy_extensions_filters_http_gcp_authn_v3_Audience_serialize_ex(const envoy_extensions_filters_http_gcp_authn_v3_Audience* msg, int options, |
||||
upb_Arena* arena, size_t* len) { |
||||
char* ptr; |
||||
(void)upb_Encode(UPB_UPCAST(msg), &envoy__extensions__filters__http__gcp_0authn__v3__Audience_msg_init, options, arena, &ptr, len); |
||||
return ptr; |
||||
} |
||||
UPB_INLINE void envoy_extensions_filters_http_gcp_authn_v3_Audience_clear_url(envoy_extensions_filters_http_gcp_authn_v3_Audience* msg) { |
||||
const upb_MiniTableField field = {1, 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 envoy_extensions_filters_http_gcp_authn_v3_Audience_url(const envoy_extensions_filters_http_gcp_authn_v3_Audience* msg) { |
||||
upb_StringView default_val = upb_StringView_FromString(""); |
||||
upb_StringView ret; |
||||
const upb_MiniTableField field = {1, 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 void envoy_extensions_filters_http_gcp_authn_v3_Audience_set_url(envoy_extensions_filters_http_gcp_authn_v3_Audience *msg, upb_StringView value) { |
||||
const upb_MiniTableField field = {1, 8, 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
||||
upb_Message_SetBaseField((upb_Message *)msg, &field, &value); |
||||
} |
||||
|
||||
/* envoy.extensions.filters.http.gcp_authn.v3.TokenCacheConfig */ |
||||
|
||||
UPB_INLINE envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig* envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig_new(upb_Arena* arena) { |
||||
return (envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig*)_upb_Message_New(&envoy__extensions__filters__http__gcp_0authn__v3__TokenCacheConfig_msg_init, arena); |
||||
} |
||||
UPB_INLINE envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig* envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig_parse(const char* buf, size_t size, upb_Arena* arena) { |
||||
envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig* ret = envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig_new(arena); |
||||
if (!ret) return NULL; |
||||
if (upb_Decode(buf, size, UPB_UPCAST(ret), &envoy__extensions__filters__http__gcp_0authn__v3__TokenCacheConfig_msg_init, NULL, 0, arena) != |
||||
kUpb_DecodeStatus_Ok) { |
||||
return NULL; |
||||
} |
||||
return ret; |
||||
} |
||||
UPB_INLINE envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig* envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig_parse_ex(const char* buf, size_t size, |
||||
const upb_ExtensionRegistry* extreg, |
||||
int options, upb_Arena* arena) { |
||||
envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig* ret = envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig_new(arena); |
||||
if (!ret) return NULL; |
||||
if (upb_Decode(buf, size, UPB_UPCAST(ret), &envoy__extensions__filters__http__gcp_0authn__v3__TokenCacheConfig_msg_init, extreg, options, |
||||
arena) != kUpb_DecodeStatus_Ok) { |
||||
return NULL; |
||||
} |
||||
return ret; |
||||
} |
||||
UPB_INLINE char* envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig_serialize(const envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig* msg, upb_Arena* arena, size_t* len) { |
||||
char* ptr; |
||||
(void)upb_Encode(UPB_UPCAST(msg), &envoy__extensions__filters__http__gcp_0authn__v3__TokenCacheConfig_msg_init, 0, arena, &ptr, len); |
||||
return ptr; |
||||
} |
||||
UPB_INLINE char* envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig_serialize_ex(const envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig* msg, int options, |
||||
upb_Arena* arena, size_t* len) { |
||||
char* ptr; |
||||
(void)upb_Encode(UPB_UPCAST(msg), &envoy__extensions__filters__http__gcp_0authn__v3__TokenCacheConfig_msg_init, options, arena, &ptr, len); |
||||
return ptr; |
||||
} |
||||
UPB_INLINE void envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig_clear_cache_size(envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig* msg) { |
||||
const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 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 google_protobuf_UInt64Value* envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig_cache_size(const envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig* msg) { |
||||
const struct google_protobuf_UInt64Value* default_val = NULL; |
||||
const struct google_protobuf_UInt64Value* ret; |
||||
const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
||||
_upb_Message_GetNonExtensionField(UPB_UPCAST(msg), &field, |
||||
&default_val, &ret); |
||||
return ret; |
||||
} |
||||
UPB_INLINE bool envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig_has_cache_size(const envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig* msg) { |
||||
const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 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 envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig_set_cache_size(envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig *msg, struct google_protobuf_UInt64Value* value) { |
||||
const upb_MiniTableField field = {1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}; |
||||
upb_Message_SetBaseField((upb_Message *)msg, &field, &value); |
||||
} |
||||
UPB_INLINE struct google_protobuf_UInt64Value* envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig_mutable_cache_size(envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig* msg, upb_Arena* arena) { |
||||
struct google_protobuf_UInt64Value* sub = (struct google_protobuf_UInt64Value*)envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig_cache_size(msg); |
||||
if (sub == NULL) { |
||||
sub = (struct google_protobuf_UInt64Value*)_upb_Message_New(&google__protobuf__UInt64Value_msg_init, arena); |
||||
if (sub) envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig_set_cache_size(msg, sub); |
||||
} |
||||
return sub; |
||||
} |
||||
|
||||
/* envoy.extensions.filters.http.gcp_authn.v3.TokenHeader */ |
||||
|
||||
UPB_INLINE envoy_extensions_filters_http_gcp_authn_v3_TokenHeader* envoy_extensions_filters_http_gcp_authn_v3_TokenHeader_new(upb_Arena* arena) { |
||||
return (envoy_extensions_filters_http_gcp_authn_v3_TokenHeader*)_upb_Message_New(&envoy__extensions__filters__http__gcp_0authn__v3__TokenHeader_msg_init, arena); |
||||
} |
||||
UPB_INLINE envoy_extensions_filters_http_gcp_authn_v3_TokenHeader* envoy_extensions_filters_http_gcp_authn_v3_TokenHeader_parse(const char* buf, size_t size, upb_Arena* arena) { |
||||
envoy_extensions_filters_http_gcp_authn_v3_TokenHeader* ret = envoy_extensions_filters_http_gcp_authn_v3_TokenHeader_new(arena); |
||||
if (!ret) return NULL; |
||||
if (upb_Decode(buf, size, UPB_UPCAST(ret), &envoy__extensions__filters__http__gcp_0authn__v3__TokenHeader_msg_init, NULL, 0, arena) != |
||||
kUpb_DecodeStatus_Ok) { |
||||
return NULL; |
||||
} |
||||
return ret; |
||||
} |
||||
UPB_INLINE envoy_extensions_filters_http_gcp_authn_v3_TokenHeader* envoy_extensions_filters_http_gcp_authn_v3_TokenHeader_parse_ex(const char* buf, size_t size, |
||||
const upb_ExtensionRegistry* extreg, |
||||
int options, upb_Arena* arena) { |
||||
envoy_extensions_filters_http_gcp_authn_v3_TokenHeader* ret = envoy_extensions_filters_http_gcp_authn_v3_TokenHeader_new(arena); |
||||
if (!ret) return NULL; |
||||
if (upb_Decode(buf, size, UPB_UPCAST(ret), &envoy__extensions__filters__http__gcp_0authn__v3__TokenHeader_msg_init, extreg, options, |
||||
arena) != kUpb_DecodeStatus_Ok) { |
||||
return NULL; |
||||
} |
||||
return ret; |
||||
} |
||||
UPB_INLINE char* envoy_extensions_filters_http_gcp_authn_v3_TokenHeader_serialize(const envoy_extensions_filters_http_gcp_authn_v3_TokenHeader* msg, upb_Arena* arena, size_t* len) { |
||||
char* ptr; |
||||
(void)upb_Encode(UPB_UPCAST(msg), &envoy__extensions__filters__http__gcp_0authn__v3__TokenHeader_msg_init, 0, arena, &ptr, len); |
||||
return ptr; |
||||
} |
||||
UPB_INLINE char* envoy_extensions_filters_http_gcp_authn_v3_TokenHeader_serialize_ex(const envoy_extensions_filters_http_gcp_authn_v3_TokenHeader* msg, int options, |
||||
upb_Arena* arena, size_t* len) { |
||||
char* ptr; |
||||
(void)upb_Encode(UPB_UPCAST(msg), &envoy__extensions__filters__http__gcp_0authn__v3__TokenHeader_msg_init, options, arena, &ptr, len); |
||||
return ptr; |
||||
} |
||||
UPB_INLINE void envoy_extensions_filters_http_gcp_authn_v3_TokenHeader_clear_name(envoy_extensions_filters_http_gcp_authn_v3_TokenHeader* msg) { |
||||
const upb_MiniTableField field = {1, 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 envoy_extensions_filters_http_gcp_authn_v3_TokenHeader_name(const envoy_extensions_filters_http_gcp_authn_v3_TokenHeader* msg) { |
||||
upb_StringView default_val = upb_StringView_FromString(""); |
||||
upb_StringView ret; |
||||
const upb_MiniTableField field = {1, 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 void envoy_extensions_filters_http_gcp_authn_v3_TokenHeader_clear_value_prefix(envoy_extensions_filters_http_gcp_authn_v3_TokenHeader* msg) { |
||||
const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 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 envoy_extensions_filters_http_gcp_authn_v3_TokenHeader_value_prefix(const envoy_extensions_filters_http_gcp_authn_v3_TokenHeader* msg) { |
||||
upb_StringView default_val = upb_StringView_FromString(""); |
||||
upb_StringView ret; |
||||
const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 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 envoy_extensions_filters_http_gcp_authn_v3_TokenHeader_set_name(envoy_extensions_filters_http_gcp_authn_v3_TokenHeader *msg, upb_StringView value) { |
||||
const upb_MiniTableField field = {1, 8, 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 envoy_extensions_filters_http_gcp_authn_v3_TokenHeader_set_value_prefix(envoy_extensions_filters_http_gcp_authn_v3_TokenHeader *msg, upb_StringView value) { |
||||
const upb_MiniTableField field = {2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}; |
||||
upb_Message_SetBaseField((upb_Message *)msg, &field, &value); |
||||
} |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#include "upb/port/undef.inc" |
||||
|
||||
#endif /* ENVOY_EXTENSIONS_FILTERS_HTTP_GCP_AUTHN_V3_GCP_AUTHN_PROTO_UPB_H_ */ |
@ -0,0 +1,129 @@ |
||||
/* This file was generated by upb_generator from the input file:
|
||||
* |
||||
* envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.proto |
||||
* |
||||
* Do not edit -- your changes will be discarded when the file is |
||||
* regenerated. */ |
||||
|
||||
#include <stddef.h> |
||||
#include "upb/generated_code_support.h" |
||||
#include "envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.h" |
||||
#include "envoy/config/core/v3/base.upb_minitable.h" |
||||
#include "envoy/config/core/v3/http_uri.upb_minitable.h" |
||||
#include "google/protobuf/duration.upb_minitable.h" |
||||
#include "google/protobuf/wrappers.upb_minitable.h" |
||||
#include "envoy/annotations/deprecation.upb_minitable.h" |
||||
#include "udpa/annotations/status.upb_minitable.h" |
||||
#include "validate/validate.upb_minitable.h" |
||||
|
||||
// Must be last.
|
||||
#include "upb/port/def.inc" |
||||
|
||||
static const upb_MiniTableSub envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_submsgs[5] = { |
||||
{.UPB_PRIVATE(submsg) = &envoy__config__core__v3__HttpUri_msg_init}, |
||||
{.UPB_PRIVATE(submsg) = &envoy__config__core__v3__RetryPolicy_msg_init}, |
||||
{.UPB_PRIVATE(submsg) = &envoy__extensions__filters__http__gcp_0authn__v3__TokenCacheConfig_msg_init}, |
||||
{.UPB_PRIVATE(submsg) = &envoy__extensions__filters__http__gcp_0authn__v3__TokenHeader_msg_init}, |
||||
{.UPB_PRIVATE(submsg) = &google__protobuf__Duration_msg_init}, |
||||
}; |
||||
|
||||
static const upb_MiniTableField envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig__fields[6] = { |
||||
{1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, |
||||
{2, UPB_SIZE(16, 24), 65, 1, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, |
||||
{3, UPB_SIZE(20, 32), 66, 2, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, |
||||
{4, UPB_SIZE(24, 40), 67, 3, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, |
||||
{5, UPB_SIZE(32, 48), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, |
||||
{6, UPB_SIZE(28, 64), 68, 4, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, |
||||
}; |
||||
|
||||
const upb_MiniTable envoy__extensions__filters__http__gcp_0authn__v3__GcpAuthnFilterConfig_msg_init = { |
||||
&envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_submsgs[0], |
||||
&envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig__fields[0], |
||||
UPB_SIZE(40, 72), 6, kUpb_ExtMode_NonExtendable, 6, UPB_FASTTABLE_MASK(56), 0, |
||||
#ifdef UPB_TRACING_ENABLED |
||||
"envoy.extensions.filters.http.gcp_authn.v3.GcpAuthnFilterConfig", |
||||
#endif |
||||
UPB_FASTTABLE_INIT({ |
||||
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, |
||||
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, |
||||
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, |
||||
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, |
||||
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, |
||||
{0x003000003f00002a, &upb_pss_1bt}, |
||||
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, |
||||
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, |
||||
}) |
||||
}; |
||||
|
||||
static const upb_MiniTableField envoy_extensions_filters_http_gcp_authn_v3_Audience__fields[1] = { |
||||
{1, 8, 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, |
||||
}; |
||||
|
||||
const upb_MiniTable envoy__extensions__filters__http__gcp_0authn__v3__Audience_msg_init = { |
||||
NULL, |
||||
&envoy_extensions_filters_http_gcp_authn_v3_Audience__fields[0], |
||||
UPB_SIZE(16, 24), 1, kUpb_ExtMode_NonExtendable, 1, UPB_FASTTABLE_MASK(8), 0, |
||||
#ifdef UPB_TRACING_ENABLED |
||||
"envoy.extensions.filters.http.gcp_authn.v3.Audience", |
||||
#endif |
||||
UPB_FASTTABLE_INIT({ |
||||
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, |
||||
{0x000800003f00000a, &upb_pss_1bt}, |
||||
}) |
||||
}; |
||||
|
||||
static const upb_MiniTableSub envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig_submsgs[1] = { |
||||
{.UPB_PRIVATE(submsg) = &google__protobuf__UInt64Value_msg_init}, |
||||
}; |
||||
|
||||
static const upb_MiniTableField envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig__fields[1] = { |
||||
{1, UPB_SIZE(12, 16), 64, 0, 11, (int)kUpb_FieldMode_Scalar | ((int)UPB_SIZE(kUpb_FieldRep_4Byte, kUpb_FieldRep_8Byte) << kUpb_FieldRep_Shift)}, |
||||
}; |
||||
|
||||
const upb_MiniTable envoy__extensions__filters__http__gcp_0authn__v3__TokenCacheConfig_msg_init = { |
||||
&envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig_submsgs[0], |
||||
&envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig__fields[0], |
||||
UPB_SIZE(16, 24), 1, kUpb_ExtMode_NonExtendable, 1, UPB_FASTTABLE_MASK(255), 0, |
||||
#ifdef UPB_TRACING_ENABLED |
||||
"envoy.extensions.filters.http.gcp_authn.v3.TokenCacheConfig", |
||||
#endif |
||||
}; |
||||
|
||||
static const upb_MiniTableField envoy_extensions_filters_http_gcp_authn_v3_TokenHeader__fields[2] = { |
||||
{1, 8, 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, |
||||
{2, UPB_SIZE(16, 24), 0, kUpb_NoSub, 9, (int)kUpb_FieldMode_Scalar | ((int)kUpb_FieldRep_StringView << kUpb_FieldRep_Shift)}, |
||||
}; |
||||
|
||||
const upb_MiniTable envoy__extensions__filters__http__gcp_0authn__v3__TokenHeader_msg_init = { |
||||
NULL, |
||||
&envoy_extensions_filters_http_gcp_authn_v3_TokenHeader__fields[0], |
||||
UPB_SIZE(24, 40), 2, kUpb_ExtMode_NonExtendable, 2, UPB_FASTTABLE_MASK(24), 0, |
||||
#ifdef UPB_TRACING_ENABLED |
||||
"envoy.extensions.filters.http.gcp_authn.v3.TokenHeader", |
||||
#endif |
||||
UPB_FASTTABLE_INIT({ |
||||
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, |
||||
{0x000800003f00000a, &upb_pss_1bt}, |
||||
{0x001800003f000012, &upb_pss_1bt}, |
||||
{0x0000000000000000, &_upb_FastDecoder_DecodeGeneric}, |
||||
}) |
||||
}; |
||||
|
||||
static const upb_MiniTable *messages_layout[4] = { |
||||
&envoy__extensions__filters__http__gcp_0authn__v3__GcpAuthnFilterConfig_msg_init, |
||||
&envoy__extensions__filters__http__gcp_0authn__v3__Audience_msg_init, |
||||
&envoy__extensions__filters__http__gcp_0authn__v3__TokenCacheConfig_msg_init, |
||||
&envoy__extensions__filters__http__gcp_0authn__v3__TokenHeader_msg_init, |
||||
}; |
||||
|
||||
const upb_MiniTableFile envoy_extensions_filters_http_gcp_authn_v3_gcp_authn_proto_upb_file_layout = { |
||||
messages_layout, |
||||
NULL, |
||||
NULL, |
||||
4, |
||||
0, |
||||
0, |
||||
}; |
||||
|
||||
#include "upb/port/undef.inc" |
||||
|
@ -0,0 +1,33 @@ |
||||
/* This file was generated by upb_generator from the input file:
|
||||
* |
||||
* envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.proto |
||||
* |
||||
* Do not edit -- your changes will be discarded when the file is |
||||
* regenerated. */ |
||||
|
||||
#ifndef ENVOY_EXTENSIONS_FILTERS_HTTP_GCP_AUTHN_V3_GCP_AUTHN_PROTO_UPB_MINITABLE_H_ |
||||
#define ENVOY_EXTENSIONS_FILTERS_HTTP_GCP_AUTHN_V3_GCP_AUTHN_PROTO_UPB_MINITABLE_H_ |
||||
|
||||
#include "upb/generated_code_support.h" |
||||
|
||||
// Must be last.
|
||||
#include "upb/port/def.inc" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
extern const upb_MiniTable envoy__extensions__filters__http__gcp_0authn__v3__GcpAuthnFilterConfig_msg_init; |
||||
extern const upb_MiniTable envoy__extensions__filters__http__gcp_0authn__v3__Audience_msg_init; |
||||
extern const upb_MiniTable envoy__extensions__filters__http__gcp_0authn__v3__TokenCacheConfig_msg_init; |
||||
extern const upb_MiniTable envoy__extensions__filters__http__gcp_0authn__v3__TokenHeader_msg_init; |
||||
|
||||
extern const upb_MiniTableFile envoy_extensions_filters_http_gcp_authn_v3_gcp_authn_proto_upb_file_layout; |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#include "upb/port/undef.inc" |
||||
|
||||
#endif /* ENVOY_EXTENSIONS_FILTERS_HTTP_GCP_AUTHN_V3_GCP_AUTHN_PROTO_UPB_MINITABLE_H_ */ |
@ -0,0 +1,86 @@ |
||||
/* This file was generated by upb_generator from the input file:
|
||||
* |
||||
* envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.proto |
||||
* |
||||
* Do not edit -- your changes will be discarded when the file is |
||||
* regenerated. */ |
||||
|
||||
#include "upb/reflection/def.h" |
||||
#include "envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upbdefs.h" |
||||
#include "envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb_minitable.h" |
||||
|
||||
extern _upb_DefPool_Init envoy_config_core_v3_base_proto_upbdefinit; |
||||
extern _upb_DefPool_Init envoy_config_core_v3_http_uri_proto_upbdefinit; |
||||
extern _upb_DefPool_Init google_protobuf_duration_proto_upbdefinit; |
||||
extern _upb_DefPool_Init google_protobuf_wrappers_proto_upbdefinit; |
||||
extern _upb_DefPool_Init envoy_annotations_deprecation_proto_upbdefinit; |
||||
extern _upb_DefPool_Init udpa_annotations_status_proto_upbdefinit; |
||||
extern _upb_DefPool_Init validate_validate_proto_upbdefinit; |
||||
static const char descriptor[1207] = {'\n', ':', 'e', 'n', 'v', 'o', 'y', '/', 'e', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', 's', '/', 'f', 'i', 'l', 't', 'e', 'r',
|
||||
's', '/', 'h', 't', 't', 'p', '/', 'g', 'c', 'p', '_', 'a', 'u', 't', 'h', 'n', '/', 'v', '3', '/', 'g', 'c', 'p', '_', 'a',
|
||||
'u', 't', 'h', 'n', '.', 'p', 'r', 'o', 't', 'o', '\022', '*', 'e', 'n', 'v', 'o', 'y', '.', 'e', 'x', 't', 'e', 'n', 's', 'i',
|
||||
'o', 'n', 's', '.', 'f', 'i', 'l', 't', 'e', 'r', 's', '.', 'h', 't', 't', 'p', '.', 'g', 'c', 'p', '_', 'a', 'u', 't', 'h',
|
||||
'n', '.', 'v', '3', '\032', '\037', 'e', 'n', 'v', 'o', 'y', '/', 'c', 'o', 'n', 'f', 'i', 'g', '/', 'c', 'o', 'r', 'e', '/', 'v',
|
||||
'3', '/', 'b', 'a', 's', 'e', '.', 'p', 'r', 'o', 't', 'o', '\032', '#', 'e', 'n', 'v', 'o', 'y', '/', 'c', 'o', 'n', 'f', 'i',
|
||||
'g', '/', 'c', 'o', 'r', 'e', '/', 'v', '3', '/', 'h', 't', 't', 'p', '_', 'u', 'r', 'i', '.', 'p', 'r', 'o', 't', 'o', '\032',
|
||||
'\036', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'd', 'u', 'r', 'a', 't', 'i', 'o', 'n',
|
||||
'.', 'p', 'r', 'o', 't', 'o', '\032', '\036', 'g', 'o', 'o', 'g', 'l', 'e', '/', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '/', 'w',
|
||||
'r', 'a', 'p', 'p', 'e', 'r', 's', '.', 'p', 'r', 'o', 't', 'o', '\032', '#', 'e', 'n', 'v', 'o', 'y', '/', 'a', 'n', 'n', 'o',
|
||||
't', 'a', 't', 'i', 'o', 'n', 's', '/', 'd', 'e', 'p', 'r', 'e', 'c', 'a', 't', 'i', 'o', 'n', '.', 'p', 'r', 'o', 't', 'o',
|
||||
'\032', '\035', 'u', 'd', 'p', 'a', '/', 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n', 's', '/', 's', 't', 'a', 't', 'u', 's',
|
||||
'.', 'p', 'r', 'o', 't', 'o', '\032', '\027', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e', '/', 'v', 'a', 'l', 'i', 'd', 'a', 't', 'e',
|
||||
'.', 'p', 'r', 'o', 't', 'o', '\"', '\301', '\003', '\n', '\024', 'G', 'c', 'p', 'A', 'u', 't', 'h', 'n', 'F', 'i', 'l', 't', 'e', 'r',
|
||||
'C', 'o', 'n', 'f', 'i', 'g', '\022', 'E', '\n', '\010', 'h', 't', 't', 'p', '_', 'u', 'r', 'i', '\030', '\001', ' ', '\001', '(', '\013', '2',
|
||||
'\035', '.', 'e', 'n', 'v', 'o', 'y', '.', 'c', 'o', 'n', 'f', 'i', 'g', '.', 'c', 'o', 'r', 'e', '.', 'v', '3', '.', 'H', 't',
|
||||
't', 'p', 'U', 'r', 'i', 'B', '\013', '\030', '\001', '\222', '\307', '\206', '\330', '\004', '\003', '3', '.', '0', 'R', '\007', 'h', 't', 't', 'p', 'U',
|
||||
'r', 'i', '\022', 'D', '\n', '\014', 'r', 'e', 't', 'r', 'y', '_', 'p', 'o', 'l', 'i', 'c', 'y', '\030', '\002', ' ', '\001', '(', '\013', '2',
|
||||
'!', '.', 'e', 'n', 'v', 'o', 'y', '.', 'c', 'o', 'n', 'f', 'i', 'g', '.', 'c', 'o', 'r', 'e', '.', 'v', '3', '.', 'R', 'e',
|
||||
't', 'r', 'y', 'P', 'o', 'l', 'i', 'c', 'y', 'R', '\013', 'r', 'e', 't', 'r', 'y', 'P', 'o', 'l', 'i', 'c', 'y', '\022', '_', '\n',
|
||||
'\014', 'c', 'a', 'c', 'h', 'e', '_', 'c', 'o', 'n', 'f', 'i', 'g', '\030', '\003', ' ', '\001', '(', '\013', '2', '<', '.', 'e', 'n', 'v',
|
||||
'o', 'y', '.', 'e', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', 's', '.', 'f', 'i', 'l', 't', 'e', 'r', 's', '.', 'h', 't', 't',
|
||||
'p', '.', 'g', 'c', 'p', '_', 'a', 'u', 't', 'h', 'n', '.', 'v', '3', '.', 'T', 'o', 'k', 'e', 'n', 'C', 'a', 'c', 'h', 'e',
|
||||
'C', 'o', 'n', 'f', 'i', 'g', 'R', '\013', 'c', 'a', 'c', 'h', 'e', 'C', 'o', 'n', 'f', 'i', 'g', '\022', 'Z', '\n', '\014', 't', 'o',
|
||||
'k', 'e', 'n', '_', 'h', 'e', 'a', 'd', 'e', 'r', '\030', '\004', ' ', '\001', '(', '\013', '2', '7', '.', 'e', 'n', 'v', 'o', 'y', '.',
|
||||
'e', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', 's', '.', 'f', 'i', 'l', 't', 'e', 'r', 's', '.', 'h', 't', 't', 'p', '.', 'g',
|
||||
'c', 'p', '_', 'a', 'u', 't', 'h', 'n', '.', 'v', '3', '.', 'T', 'o', 'k', 'e', 'n', 'H', 'e', 'a', 'd', 'e', 'r', 'R', '\013',
|
||||
't', 'o', 'k', 'e', 'n', 'H', 'e', 'a', 'd', 'e', 'r', '\022', '\030', '\n', '\007', 'c', 'l', 'u', 's', 't', 'e', 'r', '\030', '\005', ' ',
|
||||
'\001', '(', '\t', 'R', '\007', 'c', 'l', 'u', 's', 't', 'e', 'r', '\022', 'E', '\n', '\007', 't', 'i', 'm', 'e', 'o', 'u', 't', '\030', '\006',
|
||||
' ', '\001', '(', '\013', '2', '\031', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o', 't', 'o', 'b', 'u', 'f', '.', 'D', 'u',
|
||||
'r', 'a', 't', 'i', 'o', 'n', 'B', '\020', '\372', 'B', '\r', '\252', '\001', '\n', '\032', '\006', '\010', '\200', '\200', '\200', '\200', '\020', '2', '\000', 'R',
|
||||
'\007', 't', 'i', 'm', 'e', 'o', 'u', 't', '\"', '%', '\n', '\010', 'A', 'u', 'd', 'i', 'e', 'n', 'c', 'e', '\022', '\031', '\n', '\003', 'u',
|
||||
'r', 'l', '\030', '\001', ' ', '\001', '(', '\t', 'B', '\007', '\372', 'B', '\004', 'r', '\002', '\020', '\001', 'R', '\003', 'u', 'r', 'l', '\"', '`', '\n',
|
||||
'\020', 'T', 'o', 'k', 'e', 'n', 'C', 'a', 'c', 'h', 'e', 'C', 'o', 'n', 'f', 'i', 'g', '\022', 'L', '\n', '\n', 'c', 'a', 'c', 'h',
|
||||
'e', '_', 's', 'i', 'z', 'e', '\030', '\001', ' ', '\001', '(', '\013', '2', '\034', '.', 'g', 'o', 'o', 'g', 'l', 'e', '.', 'p', 'r', 'o',
|
||||
't', 'o', 'b', 'u', 'f', '.', 'U', 'I', 'n', 't', '6', '4', 'V', 'a', 'l', 'u', 'e', 'B', '\017', '\372', 'B', '\014', '2', '\n', '\030',
|
||||
'\377', '\377', '\377', '\377', '\377', '\377', '\377', '\377', '\177', 'R', '\t', 'c', 'a', 'c', 'h', 'e', 'S', 'i', 'z', 'e', '\"', '`', '\n', '\013', 'T',
|
||||
'o', 'k', 'e', 'n', 'H', 'e', 'a', 'd', 'e', 'r', '\022', '!', '\n', '\004', 'n', 'a', 'm', 'e', '\030', '\001', ' ', '\001', '(', '\t', 'B',
|
||||
'\r', '\372', 'B', '\n', 'r', '\010', '\020', '\001', '\300', '\001', '\001', '\310', '\001', '\000', 'R', '\004', 'n', 'a', 'm', 'e', '\022', '.', '\n', '\014', 'v',
|
||||
'a', 'l', 'u', 'e', '_', 'p', 'r', 'e', 'f', 'i', 'x', '\030', '\002', ' ', '\001', '(', '\t', 'B', '\013', '\372', 'B', '\010', 'r', '\006', '\300',
|
||||
'\001', '\002', '\310', '\001', '\000', 'R', '\013', 'v', 'a', 'l', 'u', 'e', 'P', 'r', 'e', 'f', 'i', 'x', 'B', '\262', '\001', '\n', '8', 'i', 'o',
|
||||
'.', 'e', 'n', 'v', 'o', 'y', 'p', 'r', 'o', 'x', 'y', '.', 'e', 'n', 'v', 'o', 'y', '.', 'e', 'x', 't', 'e', 'n', 's', 'i',
|
||||
'o', 'n', 's', '.', 'f', 'i', 'l', 't', 'e', 'r', 's', '.', 'h', 't', 't', 'p', '.', 'g', 'c', 'p', '_', 'a', 'u', 't', 'h',
|
||||
'n', '.', 'v', '3', 'B', '\r', 'G', 'c', 'p', 'A', 'u', 't', 'h', 'n', 'P', 'r', 'o', 't', 'o', 'P', '\001', 'Z', ']', 'g', 'i',
|
||||
't', 'h', 'u', 'b', '.', 'c', 'o', 'm', '/', 'e', 'n', 'v', 'o', 'y', 'p', 'r', 'o', 'x', 'y', '/', 'g', 'o', '-', 'c', 'o',
|
||||
'n', 't', 'r', 'o', 'l', '-', 'p', 'l', 'a', 'n', 'e', '/', 'e', 'n', 'v', 'o', 'y', '/', 'e', 'x', 't', 'e', 'n', 's', 'i',
|
||||
'o', 'n', 's', '/', 'f', 'i', 'l', 't', 'e', 'r', 's', '/', 'h', 't', 't', 'p', '/', 'g', 'c', 'p', '_', 'a', 'u', 't', 'h',
|
||||
'n', '/', 'v', '3', ';', 'g', 'c', 'p', '_', 'a', 'u', 't', 'h', 'n', 'v', '3', '\272', '\200', '\310', '\321', '\006', '\002', '\020', '\002', 'b',
|
||||
'\006', 'p', 'r', 'o', 't', 'o', '3',
|
||||
}; |
||||
|
||||
static _upb_DefPool_Init *deps[8] = { |
||||
&envoy_config_core_v3_base_proto_upbdefinit, |
||||
&envoy_config_core_v3_http_uri_proto_upbdefinit, |
||||
&google_protobuf_duration_proto_upbdefinit, |
||||
&google_protobuf_wrappers_proto_upbdefinit, |
||||
&envoy_annotations_deprecation_proto_upbdefinit, |
||||
&udpa_annotations_status_proto_upbdefinit, |
||||
&validate_validate_proto_upbdefinit, |
||||
NULL |
||||
}; |
||||
|
||||
_upb_DefPool_Init envoy_extensions_filters_http_gcp_authn_v3_gcp_authn_proto_upbdefinit = { |
||||
deps, |
||||
&envoy_extensions_filters_http_gcp_authn_v3_gcp_authn_proto_upb_file_layout, |
||||
"envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.proto", |
||||
UPB_STRINGVIEW_INIT(descriptor, 1207) |
||||
}; |
@ -0,0 +1,47 @@ |
||||
/* This file was generated by upb_generator from the input file:
|
||||
* |
||||
* envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.proto |
||||
* |
||||
* Do not edit -- your changes will be discarded when the file is |
||||
* regenerated. */ |
||||
|
||||
#ifndef ENVOY_EXTENSIONS_FILTERS_HTTP_GCP_AUTHN_V3_GCP_AUTHN_PROTO_UPBDEFS_H_ |
||||
#define ENVOY_EXTENSIONS_FILTERS_HTTP_GCP_AUTHN_V3_GCP_AUTHN_PROTO_UPBDEFS_H_ |
||||
|
||||
#include "upb/reflection/def.h" |
||||
#include "upb/reflection/internal/def_pool.h" |
||||
|
||||
#include "upb/port/def.inc" // Must be last. |
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
extern _upb_DefPool_Init envoy_extensions_filters_http_gcp_authn_v3_gcp_authn_proto_upbdefinit; |
||||
|
||||
UPB_INLINE const upb_MessageDef *envoy_extensions_filters_http_gcp_authn_v3_GcpAuthnFilterConfig_getmsgdef(upb_DefPool *s) { |
||||
_upb_DefPool_LoadDefInit(s, &envoy_extensions_filters_http_gcp_authn_v3_gcp_authn_proto_upbdefinit); |
||||
return upb_DefPool_FindMessageByName(s, "envoy.extensions.filters.http.gcp_authn.v3.GcpAuthnFilterConfig"); |
||||
} |
||||
|
||||
UPB_INLINE const upb_MessageDef *envoy_extensions_filters_http_gcp_authn_v3_Audience_getmsgdef(upb_DefPool *s) { |
||||
_upb_DefPool_LoadDefInit(s, &envoy_extensions_filters_http_gcp_authn_v3_gcp_authn_proto_upbdefinit); |
||||
return upb_DefPool_FindMessageByName(s, "envoy.extensions.filters.http.gcp_authn.v3.Audience"); |
||||
} |
||||
|
||||
UPB_INLINE const upb_MessageDef *envoy_extensions_filters_http_gcp_authn_v3_TokenCacheConfig_getmsgdef(upb_DefPool *s) { |
||||
_upb_DefPool_LoadDefInit(s, &envoy_extensions_filters_http_gcp_authn_v3_gcp_authn_proto_upbdefinit); |
||||
return upb_DefPool_FindMessageByName(s, "envoy.extensions.filters.http.gcp_authn.v3.TokenCacheConfig"); |
||||
} |
||||
|
||||
UPB_INLINE const upb_MessageDef *envoy_extensions_filters_http_gcp_authn_v3_TokenHeader_getmsgdef(upb_DefPool *s) { |
||||
_upb_DefPool_LoadDefInit(s, &envoy_extensions_filters_http_gcp_authn_v3_gcp_authn_proto_upbdefinit); |
||||
return upb_DefPool_FindMessageByName(s, "envoy.extensions.filters.http.gcp_authn.v3.TokenHeader"); |
||||
} |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#include "upb/port/undef.inc" |
||||
|
||||
#endif /* ENVOY_EXTENSIONS_FILTERS_HTTP_GCP_AUTHN_V3_GCP_AUTHN_PROTO_UPBDEFS_H_ */ |
@ -0,0 +1,62 @@ |
||||
//
|
||||
// Copyright 2024 gRPC authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#include "src/core/xds/grpc/xds_metadata.h" |
||||
|
||||
#include <algorithm> |
||||
#include <memory> |
||||
#include <string> |
||||
#include <utility> |
||||
|
||||
#include "absl/log/check.h" |
||||
#include "absl/strings/str_cat.h" |
||||
#include "absl/strings/str_join.h" |
||||
#include "absl/strings/string_view.h" |
||||
|
||||
namespace grpc_core { |
||||
|
||||
void XdsMetadataMap::Insert(absl::string_view key, |
||||
std::unique_ptr<XdsMetadataValue> value) { |
||||
CHECK(value != nullptr); |
||||
CHECK(map_.emplace(key, std::move(value)).second) << "duplicate key: " << key; |
||||
} |
||||
|
||||
const XdsMetadataValue* XdsMetadataMap::Find(absl::string_view key) const { |
||||
auto it = map_.find(key); |
||||
if (it == map_.end()) return nullptr; |
||||
return it->second.get(); |
||||
} |
||||
|
||||
bool XdsMetadataMap::operator==(const XdsMetadataMap& other) const { |
||||
if (map_.size() != other.map_.size()) return false; |
||||
for (const auto& p : map_) { |
||||
auto it = other.map_.find(p.first); |
||||
if (it == other.map_.end()) return false; |
||||
if (*p.second != *it->second) return false; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
std::string XdsMetadataMap::ToString() const { |
||||
std::vector<std::string> entries; |
||||
for (const auto& p : map_) { |
||||
entries.push_back(absl::StrCat(p.first, "=", p.second->ToString())); |
||||
} |
||||
std::sort(entries.begin(), entries.end()); |
||||
return absl::StrCat("{", absl::StrJoin(entries, ", "), "}"); |
||||
} |
||||
|
||||
} // namespace grpc_core
|
@ -0,0 +1,127 @@ |
||||
//
|
||||
// Copyright 2024 gRPC authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#ifndef GRPC_SRC_CORE_XDS_GRPC_XDS_METADATA_H |
||||
#define GRPC_SRC_CORE_XDS_GRPC_XDS_METADATA_H |
||||
|
||||
#include <memory> |
||||
#include <string> |
||||
#include <utility> |
||||
|
||||
#include "absl/container/flat_hash_map.h" |
||||
#include "absl/strings/str_cat.h" |
||||
#include "absl/strings/string_view.h" |
||||
|
||||
#include "src/core/lib/gprpp/down_cast.h" |
||||
#include "src/core/lib/gprpp/validation_errors.h" |
||||
#include "src/core/util/json/json.h" |
||||
#include "src/core/util/json/json_writer.h" |
||||
|
||||
namespace grpc_core { |
||||
|
||||
// Interface for metadata value types.
|
||||
class XdsMetadataValue { |
||||
public: |
||||
virtual ~XdsMetadataValue() = default; |
||||
|
||||
// The proto message name.
|
||||
virtual absl::string_view type() const = 0; |
||||
|
||||
bool operator==(const XdsMetadataValue& other) const { |
||||
return type() == other.type() && Equals(other); |
||||
} |
||||
bool operator!=(const XdsMetadataValue& other) const { |
||||
return !(*this == other); |
||||
} |
||||
|
||||
virtual std::string ToString() const = 0; |
||||
|
||||
private: |
||||
// Called only if the type() methods return the same thing.
|
||||
virtual bool Equals(const XdsMetadataValue& other) const = 0; |
||||
}; |
||||
|
||||
// Metadata map.
|
||||
class XdsMetadataMap { |
||||
public: |
||||
void Insert(absl::string_view key, std::unique_ptr<XdsMetadataValue> value); |
||||
|
||||
const XdsMetadataValue* Find(absl::string_view key) const; |
||||
|
||||
bool empty() const { return map_.empty(); } |
||||
size_t size() const { return map_.size(); } |
||||
|
||||
bool operator==(const XdsMetadataMap& other) const; |
||||
|
||||
std::string ToString() const; |
||||
|
||||
private: |
||||
absl::flat_hash_map<std::string, std::unique_ptr<XdsMetadataValue>> map_; |
||||
}; |
||||
|
||||
// Concrete metadata value type for google.protobuf.Struct.
|
||||
class XdsStructMetadataValue : public XdsMetadataValue { |
||||
public: |
||||
explicit XdsStructMetadataValue(Json json) : json_(std::move(json)) {} |
||||
|
||||
static absl::string_view Type() { return "google.protobuf.Struct"; } |
||||
|
||||
absl::string_view type() const override { return Type(); } |
||||
|
||||
const Json& json() const { return json_; } |
||||
|
||||
std::string ToString() const override { |
||||
return absl::StrCat(type(), "{", JsonDump(json_), "}"); |
||||
} |
||||
|
||||
private: |
||||
bool Equals(const XdsMetadataValue& other) const override { |
||||
return json_ == DownCast<const XdsStructMetadataValue&>(other).json_; |
||||
} |
||||
|
||||
Json json_; |
||||
}; |
||||
|
||||
// Concrete metadata value type for GCP Authn filter Audience.
|
||||
class XdsGcpAuthnAudienceMetadataValue : public XdsMetadataValue { |
||||
public: |
||||
explicit XdsGcpAuthnAudienceMetadataValue(absl::string_view url) |
||||
: url_(url) {} |
||||
|
||||
static absl::string_view Type() { |
||||
return "envoy.extensions.filters.http.gcp_authn.v3.Audience"; |
||||
} |
||||
|
||||
absl::string_view type() const override { return Type(); } |
||||
|
||||
const std::string& url() const { return url_; } |
||||
|
||||
std::string ToString() const override { |
||||
return absl::StrCat(type(), "{url=\"", url_, "\"}"); |
||||
} |
||||
|
||||
private: |
||||
bool Equals(const XdsMetadataValue& other) const override { |
||||
return url_ == |
||||
DownCast<const XdsGcpAuthnAudienceMetadataValue&>(other).url_; |
||||
} |
||||
|
||||
std::string url_; |
||||
}; |
||||
|
||||
} // namespace grpc_core
|
||||
|
||||
#endif // GRPC_SRC_CORE_XDS_GRPC_XDS_METADATA_H
|
@ -0,0 +1,143 @@ |
||||
// Copyright 2018 gRPC authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#include "src/core/xds/grpc/xds_metadata_parser.h" |
||||
|
||||
#include <memory> |
||||
#include <utility> |
||||
|
||||
#include "absl/strings/str_cat.h" |
||||
#include "absl/strings/string_view.h" |
||||
#include "absl/types/variant.h" |
||||
#include "envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upb.h" |
||||
#include "envoy/extensions/filters/http/gcp_authn/v3/gcp_authn.upbdefs.h" |
||||
#include "upb/base/string_view.h" |
||||
#include "upb/text/encode.h" |
||||
|
||||
#include "src/core/lib/gprpp/env.h" |
||||
#include "src/core/lib/gprpp/validation_errors.h" |
||||
#include "src/core/util/string.h" |
||||
#include "src/core/util/upb_utils.h" |
||||
#include "src/core/xds/grpc/xds_common_types.h" |
||||
#include "src/core/xds/grpc/xds_common_types_parser.h" |
||||
|
||||
namespace grpc_core { |
||||
|
||||
// TODO(roth): Remove this once GCP auth filter support is stable.
|
||||
bool XdsGcpAuthFilterEnabled() { |
||||
auto value = GetEnv("GRPC_EXPERIMENTAL_XDS_GCP_AUTHENTICATION_FILTER"); |
||||
if (!value.has_value()) return false; |
||||
bool parsed_value; |
||||
bool parse_succeeded = gpr_parse_bool_value(value->c_str(), &parsed_value); |
||||
return parse_succeeded && parsed_value; |
||||
} |
||||
|
||||
namespace { |
||||
|
||||
std::unique_ptr<XdsMetadataValue> ParseGcpAuthnAudience( |
||||
const XdsResourceType::DecodeContext& context, XdsExtension extension, |
||||
ValidationErrors* errors) { |
||||
absl::string_view* serialized_proto = |
||||
absl::get_if<absl::string_view>(&extension.value); |
||||
if (serialized_proto == nullptr) { |
||||
errors->AddError("could not parse audience metadata"); |
||||
return nullptr; |
||||
} |
||||
auto* proto = envoy_extensions_filters_http_gcp_authn_v3_Audience_parse( |
||||
serialized_proto->data(), serialized_proto->size(), context.arena); |
||||
if (proto == nullptr) { |
||||
errors->AddError("could not parse audience metadata"); |
||||
return nullptr; |
||||
} |
||||
if (GRPC_TRACE_FLAG_ENABLED_OBJ(*context.tracer) && ABSL_VLOG_IS_ON(2)) { |
||||
const upb_MessageDef* msg_type = |
||||
envoy_extensions_filters_http_gcp_authn_v3_Audience_getmsgdef( |
||||
context.symtab); |
||||
char buf[10240]; |
||||
upb_TextEncode(reinterpret_cast<const upb_Message*>(proto), msg_type, |
||||
nullptr, 0, buf, sizeof(buf)); |
||||
VLOG(2) << "[xds_client " << context.client |
||||
<< "] cluster metadata Audience: " << buf; |
||||
} |
||||
absl::string_view url = UpbStringToAbsl( |
||||
envoy_extensions_filters_http_gcp_authn_v3_Audience_url(proto)); |
||||
if (url.empty()) { |
||||
ValidationErrors::ScopedField field(errors, ".url"); |
||||
errors->AddError("must be non-empty"); |
||||
return nullptr; |
||||
} |
||||
return std::make_unique<XdsGcpAuthnAudienceMetadataValue>(url); |
||||
} |
||||
|
||||
} // namespace
|
||||
|
||||
XdsMetadataMap ParseXdsMetadataMap( |
||||
const XdsResourceType::DecodeContext& context, |
||||
const envoy_config_core_v3_Metadata* metadata, ValidationErrors* errors) { |
||||
XdsMetadataMap metadata_map; |
||||
if (metadata == nullptr) return metadata_map; // Not present == empty.
|
||||
// First, try typed_filter_metadata.
|
||||
size_t iter = kUpb_Map_Begin; |
||||
const envoy_config_core_v3_Metadata_TypedFilterMetadataEntry* typed_entry; |
||||
while ( |
||||
(typed_entry = envoy_config_core_v3_Metadata_typed_filter_metadata_next( |
||||
metadata, &iter)) != nullptr) { |
||||
absl::string_view key = UpbStringToAbsl( |
||||
envoy_config_core_v3_Metadata_TypedFilterMetadataEntry_key( |
||||
typed_entry)); |
||||
ValidationErrors::ScopedField field( |
||||
errors, absl::StrCat(".typed_filter_metadata[", key, "]")); |
||||
auto extension = ExtractXdsExtension( |
||||
context, |
||||
envoy_config_core_v3_Metadata_TypedFilterMetadataEntry_value( |
||||
typed_entry), |
||||
errors); |
||||
if (!extension.has_value()) continue; |
||||
// TODO(roth): If we ever need to support another type here, refactor
|
||||
// this into a separate registry.
|
||||
if (XdsGcpAuthFilterEnabled() && |
||||
extension->type == XdsGcpAuthnAudienceMetadataValue::Type()) { |
||||
auto metadata_value = |
||||
ParseGcpAuthnAudience(context, std::move(*extension), errors); |
||||
if (metadata_value != nullptr) { |
||||
metadata_map.Insert(key, std::move(metadata_value)); |
||||
} |
||||
} |
||||
} |
||||
// Then, try filter_metadata.
|
||||
iter = kUpb_Map_Begin; |
||||
const envoy_config_core_v3_Metadata_FilterMetadataEntry* entry; |
||||
while ((entry = envoy_config_core_v3_Metadata_filter_metadata_next( |
||||
metadata, &iter)) != nullptr) { |
||||
absl::string_view key = UpbStringToAbsl( |
||||
envoy_config_core_v3_Metadata_FilterMetadataEntry_key(entry)); |
||||
auto json = ParseProtobufStructToJson( |
||||
context, |
||||
envoy_config_core_v3_Metadata_FilterMetadataEntry_value(entry)); |
||||
if (!json.ok()) { |
||||
ValidationErrors::ScopedField field( |
||||
errors, absl::StrCat(".filter_metadata[", key, "]")); |
||||
errors->AddError(json.status().message()); |
||||
} |
||||
// Add only if not already added from typed_filter_metadata.
|
||||
else if (metadata_map.Find(key) == nullptr) { |
||||
metadata_map.Insert( |
||||
key, std::make_unique<XdsStructMetadataValue>(std::move(*json))); |
||||
} |
||||
} |
||||
return metadata_map; |
||||
} |
||||
|
||||
} // namespace grpc_core
|
@ -0,0 +1,36 @@ |
||||
//
|
||||
// Copyright 2024 gRPC authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#ifndef GRPC_SRC_CORE_XDS_GRPC_XDS_METADATA_PARSER_H |
||||
#define GRPC_SRC_CORE_XDS_GRPC_XDS_METADATA_PARSER_H |
||||
|
||||
#include "envoy/config/core/v3/base.upb.h" |
||||
|
||||
#include "src/core/lib/gprpp/validation_errors.h" |
||||
#include "src/core/xds/grpc/xds_metadata.h" |
||||
#include "src/core/xds/xds_client/xds_resource_type.h" |
||||
|
||||
namespace grpc_core { |
||||
|
||||
bool XdsGcpAuthFilterEnabled(); |
||||
|
||||
XdsMetadataMap ParseXdsMetadataMap( |
||||
const XdsResourceType::DecodeContext& context, |
||||
const envoy_config_core_v3_Metadata* metadata, ValidationErrors* errors); |
||||
|
||||
} // namespace grpc_core
|
||||
|
||||
#endif // GRPC_SRC_CORE_XDS_GRPC_XDS_METADATA_PARSER_H
|
@ -0,0 +1,45 @@ |
||||
// Copyright 2024 The gRPC Authors |
||||
// |
||||
// Licensed under the Apache License, Version 2.0 (the "License"); |
||||
// you may not use this file except in compliance with the License. |
||||
// You may obtain a copy of the License at |
||||
// |
||||
// http://www.apache.org/licenses/LICENSE-2.0 |
||||
// |
||||
// Unless required by applicable law or agreed to in writing, software |
||||
// distributed under the License is distributed on an "AS IS" BASIS, |
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
// See the License for the specific language governing permissions and |
||||
// limitations under the License. |
||||
|
||||
// Local copy of Envoy xDS proto file, used for testing only. |
||||
|
||||
syntax = "proto3"; |
||||
|
||||
package envoy.extensions.filters.http.gcp_authn.v3; |
||||
|
||||
import "google/protobuf/wrappers.proto"; |
||||
|
||||
// [#protodoc-title: GCP authentication] |
||||
// GCP authentication :ref:`configuration overview <config_http_filters_gcp_authn>`. |
||||
// [#extension: envoy.filters.http.gcp_authn] |
||||
|
||||
// Filter configuration. |
||||
// [#next-free-field: 7] |
||||
message GcpAuthnFilterConfig { |
||||
// Token cache configuration. This field is optional. |
||||
TokenCacheConfig cache_config = 3; |
||||
} |
||||
|
||||
// Audience is the URL of the receiving service that performs token authentication. |
||||
// It will be provided to the filter through cluster's typed_filter_metadata. |
||||
message Audience { |
||||
string url = 1; |
||||
} |
||||
|
||||
// Token Cache configuration. |
||||
message TokenCacheConfig { |
||||
// The number of cache entries. The maximum number of entries is INT64_MAX as it is constrained by underlying cache implementation. |
||||
// Default value 0 (i.e., proto3 defaults) disables the cache by default. Other default values will enable the cache. |
||||
google.protobuf.UInt64Value cache_size = 1; |
||||
} |
@ -0,0 +1,274 @@ |
||||
//
|
||||
// Copyright 2022 gRPC authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#include "src/core/xds/grpc/xds_metadata.h" |
||||
|
||||
#include <string> |
||||
#include <utility> |
||||
|
||||
#include <google/protobuf/any.pb.h> |
||||
#include <google/protobuf/struct.pb.h> |
||||
|
||||
#include "absl/status/status.h" |
||||
#include "absl/status/statusor.h" |
||||
#include "absl/strings/str_format.h" |
||||
#include "gmock/gmock.h" |
||||
#include "gtest/gtest.h" |
||||
|
||||
#include "src/core/lib/debug/trace.h" |
||||
#include "src/core/lib/gprpp/crash.h" |
||||
#include "src/core/lib/gprpp/ref_counted_ptr.h" |
||||
#include "src/core/util/json/json.h" |
||||
#include "src/core/util/json/json_writer.h" |
||||
#include "src/core/xds/grpc/xds_bootstrap_grpc.h" |
||||
#include "src/core/xds/grpc/xds_metadata_parser.h" |
||||
#include "src/core/xds/xds_client/xds_bootstrap.h" |
||||
#include "src/core/xds/xds_client/xds_client.h" |
||||
#include "src/core/xds/xds_client/xds_resource_type.h" |
||||
#include "src/proto/grpc/testing/xds/v3/base.pb.h" |
||||
#include "src/proto/grpc/testing/xds/v3/gcp_authn.pb.h" |
||||
#include "test/core/test_util/scoped_env_var.h" |
||||
#include "test/core/test_util/test_config.h" |
||||
|
||||
using envoy::config::core::v3::Metadata; |
||||
using envoy::extensions::filters::http::gcp_authn::v3::Audience; |
||||
|
||||
namespace grpc_core { |
||||
namespace testing { |
||||
namespace { |
||||
|
||||
class XdsMetadataTest : public ::testing::Test { |
||||
protected: |
||||
XdsMetadataTest() |
||||
: xds_client_(MakeXdsClient()), |
||||
decode_context_{ |
||||
xds_client_.get(), *xds_client_->bootstrap().servers().front(), |
||||
&xds_unittest_trace, upb_def_pool_.ptr(), upb_arena_.ptr()} {} |
||||
|
||||
static RefCountedPtr<XdsClient> MakeXdsClient() { |
||||
auto bootstrap = GrpcXdsBootstrap::Create( |
||||
"{\n" |
||||
" \"xds_servers\": [\n" |
||||
" {\n" |
||||
" \"server_uri\": \"xds.example.com\",\n" |
||||
" \"channel_creds\": [\n" |
||||
" {\"type\": \"google_default\"}\n" |
||||
" ]\n" |
||||
" }\n" |
||||
" ]\n" |
||||
"}"); |
||||
if (!bootstrap.ok()) { |
||||
Crash(absl::StrFormat("Error parsing bootstrap: %s", |
||||
bootstrap.status().ToString().c_str())); |
||||
} |
||||
return MakeRefCounted<XdsClient>(std::move(*bootstrap), |
||||
/*transport_factory=*/nullptr, |
||||
/*event_engine=*/nullptr, |
||||
/*metrics_reporter=*/nullptr, "foo agent", |
||||
"foo version"); |
||||
} |
||||
|
||||
// For convenience, tests build protos using the protobuf API and then
|
||||
// use this function to convert it to a upb object, which can be
|
||||
// passed to ParseXdsMetadataMap() for validation.
|
||||
const envoy_config_core_v3_Metadata* ConvertToUpb(Metadata proto) { |
||||
// Serialize the protobuf proto.
|
||||
std::string serialized_proto; |
||||
if (!proto.SerializeToString(&serialized_proto)) { |
||||
EXPECT_TRUE(false) << "protobuf serialization failed"; |
||||
return nullptr; |
||||
} |
||||
// Deserialize as upb proto.
|
||||
const auto* upb_proto = envoy_config_core_v3_Metadata_parse( |
||||
serialized_proto.data(), serialized_proto.size(), upb_arena_.ptr()); |
||||
if (upb_proto == nullptr) { |
||||
EXPECT_TRUE(false) << "upb parsing failed"; |
||||
return nullptr; |
||||
} |
||||
return upb_proto; |
||||
} |
||||
|
||||
absl::StatusOr<XdsMetadataMap> Parse( |
||||
const envoy_config_core_v3_Metadata* upb_proto) { |
||||
ValidationErrors errors; |
||||
XdsMetadataMap metadata_map = |
||||
ParseXdsMetadataMap(decode_context_, upb_proto, &errors); |
||||
if (!errors.ok()) { |
||||
return errors.status(absl::StatusCode::kInvalidArgument, |
||||
"validation failed"); |
||||
} |
||||
return metadata_map; |
||||
} |
||||
|
||||
absl::StatusOr<XdsMetadataMap> Decode(Metadata proto) { |
||||
const envoy_config_core_v3_Metadata* upb_proto = |
||||
ConvertToUpb(std::move(proto)); |
||||
return Parse(upb_proto); |
||||
} |
||||
|
||||
RefCountedPtr<XdsClient> xds_client_; |
||||
upb::DefPool upb_def_pool_; |
||||
upb::Arena upb_arena_; |
||||
XdsResourceType::DecodeContext decode_context_; |
||||
}; |
||||
|
||||
MATCHER_P(JsonEq, json_str, "") { |
||||
std::string actual = JsonDump(arg); |
||||
bool ok = ::testing::ExplainMatchResult(json_str, actual, result_listener); |
||||
if (!ok) *result_listener << "Actual: " << actual; |
||||
return ok; |
||||
} |
||||
|
||||
TEST_F(XdsMetadataTest, UntypedMetadata) { |
||||
Metadata metadata_proto; |
||||
auto& filter_map = *metadata_proto.mutable_filter_metadata(); |
||||
auto& label_map = *filter_map["filter_key"].mutable_fields(); |
||||
*label_map["string_value"].mutable_string_value() = "abc"; |
||||
label_map["bool_value"].set_bool_value(true); |
||||
label_map["number_value"].set_number_value(3.14); |
||||
label_map["null_value"].set_null_value(::google::protobuf::NULL_VALUE); |
||||
auto& list_value_values = |
||||
*label_map["list_value"].mutable_list_value()->mutable_values(); |
||||
*list_value_values.Add()->mutable_string_value() = "efg"; |
||||
list_value_values.Add()->set_number_value(3.14); |
||||
auto& struct_value_fields = |
||||
*label_map["struct_value"].mutable_struct_value()->mutable_fields(); |
||||
struct_value_fields["bool_value"].set_bool_value(false); |
||||
// Decode.
|
||||
auto metadata_map = Decode(std::move(metadata_proto)); |
||||
ASSERT_TRUE(metadata_map.ok()) << metadata_map.status(); |
||||
ASSERT_EQ(metadata_map->size(), 1); |
||||
auto* entry = metadata_map->Find("filter_key"); |
||||
ASSERT_NE(entry, nullptr); |
||||
ASSERT_EQ(XdsStructMetadataValue::Type(), entry->type()); |
||||
EXPECT_THAT(DownCast<const XdsStructMetadataValue*>(entry)->json(), |
||||
JsonEq("{" |
||||
"\"bool_value\":true," |
||||
"\"list_value\":[\"efg\",3.14]," |
||||
"\"null_value\":null," |
||||
"\"number_value\":3.14," |
||||
"\"string_value\":\"abc\"," |
||||
"\"struct_value\":{\"bool_value\":false}" |
||||
"}")); |
||||
} |
||||
|
||||
TEST_F(XdsMetadataTest, TypedMetadataTakesPrecendenceOverUntyped) { |
||||
ScopedExperimentalEnvVar env_var( |
||||
"GRPC_EXPERIMENTAL_XDS_GCP_AUTHENTICATION_FILTER"); |
||||
Metadata metadata_proto; |
||||
auto& filter_map = *metadata_proto.mutable_filter_metadata(); |
||||
auto& label_map = *filter_map["filter_key"].mutable_fields(); |
||||
*label_map["string_value"].mutable_string_value() = "abc"; |
||||
Audience audience_proto; |
||||
audience_proto.set_url("foo"); |
||||
auto& typed_filter_map = *metadata_proto.mutable_typed_filter_metadata(); |
||||
typed_filter_map["filter_key"].PackFrom(audience_proto); |
||||
// Decode.
|
||||
auto metadata_map = Decode(std::move(metadata_proto)); |
||||
ASSERT_TRUE(metadata_map.ok()) << metadata_map.status(); |
||||
ASSERT_EQ(metadata_map->size(), 1); |
||||
auto* entry = metadata_map->Find("filter_key"); |
||||
ASSERT_NE(entry, nullptr); |
||||
ASSERT_EQ(XdsGcpAuthnAudienceMetadataValue::Type(), entry->type()); |
||||
EXPECT_EQ(DownCast<const XdsGcpAuthnAudienceMetadataValue*>(entry)->url(), |
||||
"foo"); |
||||
} |
||||
|
||||
TEST_F(XdsMetadataTest, AudienceMetadata) { |
||||
ScopedExperimentalEnvVar env_var( |
||||
"GRPC_EXPERIMENTAL_XDS_GCP_AUTHENTICATION_FILTER"); |
||||
Audience audience_proto; |
||||
audience_proto.set_url("foo"); |
||||
Metadata metadata_proto; |
||||
auto& filter_map = *metadata_proto.mutable_typed_filter_metadata(); |
||||
filter_map["filter_key"].PackFrom(audience_proto); |
||||
// Decode.
|
||||
auto metadata_map = Decode(std::move(metadata_proto)); |
||||
ASSERT_TRUE(metadata_map.ok()) << metadata_map.status(); |
||||
ASSERT_EQ(metadata_map->size(), 1); |
||||
auto* entry = metadata_map->Find("filter_key"); |
||||
ASSERT_NE(entry, nullptr); |
||||
ASSERT_EQ(XdsGcpAuthnAudienceMetadataValue::Type(), entry->type()); |
||||
EXPECT_EQ(DownCast<const XdsGcpAuthnAudienceMetadataValue*>(entry)->url(), |
||||
"foo"); |
||||
} |
||||
|
||||
TEST_F(XdsMetadataTest, AudienceMetadataUnparseable) { |
||||
ScopedExperimentalEnvVar env_var( |
||||
"GRPC_EXPERIMENTAL_XDS_GCP_AUTHENTICATION_FILTER"); |
||||
Metadata metadata_proto; |
||||
auto& filter_map = *metadata_proto.mutable_typed_filter_metadata(); |
||||
auto& entry = filter_map["filter_key"]; |
||||
entry.PackFrom(Audience()); |
||||
entry.set_value(std::string("\0", 1)); |
||||
// Decode.
|
||||
auto metadata_map = Decode(std::move(metadata_proto)); |
||||
EXPECT_EQ(metadata_map.status().code(), absl::StatusCode::kInvalidArgument); |
||||
EXPECT_EQ(metadata_map.status().message(), |
||||
"validation failed: [" |
||||
"field:typed_filter_metadata[filter_key].value[" |
||||
"envoy.extensions.filters.http.gcp_authn.v3.Audience] " |
||||
"error:could not parse audience metadata]") |
||||
<< metadata_map.status(); |
||||
} |
||||
|
||||
TEST_F(XdsMetadataTest, AudienceMetadataMissingUrl) { |
||||
ScopedExperimentalEnvVar env_var( |
||||
"GRPC_EXPERIMENTAL_XDS_GCP_AUTHENTICATION_FILTER"); |
||||
Metadata metadata_proto; |
||||
auto& filter_map = *metadata_proto.mutable_typed_filter_metadata(); |
||||
filter_map["filter_key"].PackFrom(Audience()); |
||||
// Decode.
|
||||
auto metadata_map = Decode(std::move(metadata_proto)); |
||||
EXPECT_EQ(metadata_map.status().code(), absl::StatusCode::kInvalidArgument); |
||||
EXPECT_EQ(metadata_map.status().message(), |
||||
"validation failed: [" |
||||
"field:typed_filter_metadata[filter_key].value[" |
||||
"envoy.extensions.filters.http.gcp_authn.v3.Audience].url " |
||||
"error:must be non-empty]") |
||||
<< metadata_map.status(); |
||||
} |
||||
|
||||
TEST_F(XdsMetadataTest, AudienceIgnoredIfNotEnabled) { |
||||
Audience audience_proto; |
||||
audience_proto.set_url("foo"); |
||||
Metadata metadata_proto; |
||||
auto& filter_map = *metadata_proto.mutable_typed_filter_metadata(); |
||||
filter_map["filter_key"].PackFrom(audience_proto); |
||||
// Decode.
|
||||
auto metadata_map = Decode(std::move(metadata_proto)); |
||||
ASSERT_TRUE(metadata_map.ok()) << metadata_map.status(); |
||||
EXPECT_EQ(metadata_map->size(), 0); |
||||
} |
||||
|
||||
TEST_F(XdsMetadataTest, MetadataUnset) { |
||||
auto metadata_map = Parse(nullptr); |
||||
ASSERT_TRUE(metadata_map.ok()) << metadata_map.status(); |
||||
EXPECT_EQ(metadata_map->size(), 0); |
||||
} |
||||
|
||||
} // namespace
|
||||
} // namespace testing
|
||||
} // namespace grpc_core
|
||||
|
||||
int main(int argc, char** argv) { |
||||
::testing::InitGoogleTest(&argc, argv); |
||||
grpc::testing::TestEnvironment env(&argc, argv); |
||||
grpc_init(); |
||||
int ret = RUN_ALL_TESTS(); |
||||
grpc_shutdown(); |
||||
return ret; |
||||
} |
Loading…
Reference in new issue