use of io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CommonTlsContext in project grpc-java by grpc.
the class ClientXdsClientDataTest method validateCommonTlsContext_combinedValContextWithDfltValContextCustomValidatorConfig.
@Test
@SuppressWarnings("deprecation")
public void validateCommonTlsContext_combinedValContextWithDfltValContextCustomValidatorConfig() throws ResourceInvalidException {
CommonTlsContext commonTlsContext = CommonTlsContext.newBuilder().setCombinedValidationContext(CommonTlsContext.CombinedCertificateValidationContext.newBuilder().setValidationContextCertificateProviderInstance(CommonTlsContext.CertificateProviderInstance.getDefaultInstance()).setDefaultValidationContext(CertificateValidationContext.newBuilder().setCustomValidatorConfig(TypedExtensionConfig.getDefaultInstance()))).setTlsCertificateCertificateProviderInstance(CommonTlsContext.CertificateProviderInstance.getDefaultInstance()).build();
thrown.expect(ResourceInvalidException.class);
thrown.expectMessage("custom_validator_config in default_validation_context is not " + "supported");
ClientXdsClient.validateCommonTlsContext(commonTlsContext, ImmutableSet.of(""), false);
}
use of io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CommonTlsContext in project grpc-java by grpc.
the class ClientXdsClientDataTest method validateCommonTlsContext_combinedValidationContextWithoutCertProviderInstance.
@Test
public void validateCommonTlsContext_combinedValidationContextWithoutCertProviderInstance() throws ResourceInvalidException {
CommonTlsContext commonTlsContext = CommonTlsContext.newBuilder().setCombinedValidationContext(CommonTlsContext.CombinedCertificateValidationContext.getDefaultInstance()).build();
thrown.expect(ResourceInvalidException.class);
thrown.expectMessage("ca_certificate_provider_instance is required in upstream-tls-context");
ClientXdsClient.validateCommonTlsContext(commonTlsContext, null, false);
}
use of io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CommonTlsContext in project grpc-java by grpc.
the class ClientXdsClientDataTest method validateCommonTlsContext_tlsCertificateSdsSecretConfigsCount.
@Test
public void validateCommonTlsContext_tlsCertificateSdsSecretConfigsCount() throws ResourceInvalidException {
CommonTlsContext commonTlsContext = CommonTlsContext.newBuilder().addTlsCertificateSdsSecretConfigs(SdsSecretConfig.getDefaultInstance()).build();
thrown.expect(ResourceInvalidException.class);
thrown.expectMessage("tls_certificate_provider_instance is unset");
ClientXdsClient.validateCommonTlsContext(commonTlsContext, null, false);
}
use of io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CommonTlsContext in project grpc-java by grpc.
the class ClientXdsClientDataTest method validateCommonTlsContext_validationContextSdsSecretConfig.
@Test
public void validateCommonTlsContext_validationContextSdsSecretConfig() throws ResourceInvalidException {
CommonTlsContext commonTlsContext = CommonTlsContext.newBuilder().setValidationContextSdsSecretConfig(SdsSecretConfig.getDefaultInstance()).build();
thrown.expect(ResourceInvalidException.class);
thrown.expectMessage("common-tls-context with validation_context_sds_secret_config is not supported");
ClientXdsClient.validateCommonTlsContext(commonTlsContext, null, false);
}
use of io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CommonTlsContext in project grpc-java by grpc.
the class ClientXdsClientDataTest method validateDownstreamTlsContext_hasRequireSni.
@Test
@SuppressWarnings("deprecation")
public void validateDownstreamTlsContext_hasRequireSni() throws ResourceInvalidException {
CommonTlsContext commonTlsContext = CommonTlsContext.newBuilder().setCombinedValidationContext(CommonTlsContext.CombinedCertificateValidationContext.newBuilder().setValidationContextCertificateProviderInstance(CommonTlsContext.CertificateProviderInstance.getDefaultInstance())).setTlsCertificateCertificateProviderInstance(CommonTlsContext.CertificateProviderInstance.getDefaultInstance()).build();
DownstreamTlsContext downstreamTlsContext = DownstreamTlsContext.newBuilder().setCommonTlsContext(commonTlsContext).setRequireSni(BoolValue.of(true)).build();
thrown.expect(ResourceInvalidException.class);
thrown.expectMessage("downstream-tls-context with require-sni is not supported");
ClientXdsClient.validateDownstreamTlsContext(downstreamTlsContext, ImmutableSet.of(""));
}
Aggregations