Update CertificateProviderInstance passing to include certificate name

pull/24671/head
Yash Tibrewal 4 years ago
parent 5fc1a7c8cc
commit 0d4069a7a3
  1. 26
      src/core/ext/xds/xds_api.cc
  2. 15
      src/core/ext/xds/xds_api.h

@ -1383,6 +1383,19 @@ grpc_error* RdsResponseParse(
return GRPC_ERROR_NONE;
}
XdsApi::CommonTlsContext::CertificateProviderInstance
CertificateProviderInstanceParse(
const envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance*
certificate_provider_instance_proto) {
return {
UpbStringToStdString(
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance_instance_name(
certificate_provider_instance_proto)),
UpbStringToStdString(
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance_certificate_name(
certificate_provider_instance_proto))};
}
grpc_error* CommonTlsContextParse(
const envoy_extensions_transport_sockets_tls_v3_CommonTlsContext*
common_tls_context_proto,
@ -1452,19 +1465,18 @@ grpc_error* CommonTlsContextParse(
combined_validation_context);
if (validation_context_certificate_provider_instance != nullptr) {
common_tls_context->combined_validation_context
.validation_context_certificate_provider_instance = UpbStringToStdString(
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance_instance_name(
validation_context_certificate_provider_instance));
.validation_context_certificate_provider_instance =
CertificateProviderInstanceParse(
validation_context_certificate_provider_instance);
}
}
auto* tls_certificate_certificate_provider_instance =
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_tls_certificate_certificate_provider_instance(
common_tls_context_proto);
if (tls_certificate_certificate_provider_instance != nullptr) {
common_tls_context
->tls_certificate_certificate_provider_instance = UpbStringToStdString(
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance_instance_name(
tls_certificate_certificate_provider_instance));
common_tls_context->tls_certificate_certificate_provider_instance =
CertificateProviderInstanceParse(
tls_certificate_certificate_provider_instance);
}
return GRPC_ERROR_NONE;
}

@ -198,9 +198,20 @@ class XdsApi {
}
};
struct CertificateProviderInstance {
std::string instance_name;
std::string certificate_name;
bool operator==(const CertificateProviderInstance& other) const {
return instance_name == other.instance_name &&
certificate_name == other.certificate_name;
}
};
struct CombinedCertificateValidationContext {
CertificateValidationContext default_validation_context;
std::string validation_context_certificate_provider_instance;
CertificateProviderInstance
validation_context_certificate_provider_instance;
bool operator==(const CombinedCertificateValidationContext& other) const {
return default_validation_context == other.default_validation_context &&
@ -209,7 +220,7 @@ class XdsApi {
}
};
std::string tls_certificate_certificate_provider_instance;
CertificateProviderInstance tls_certificate_certificate_provider_instance;
CombinedCertificateValidationContext combined_validation_context;
bool operator==(const CommonTlsContext& other) const {

Loading…
Cancel
Save