use of io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CommonTlsContext in project grpc-java by grpc.
the class ClientXdsClientDataTest method validateCommonTlsContext_tlsCertificateCertificateProvider.
@Test
@SuppressWarnings("deprecation")
public void validateCommonTlsContext_tlsCertificateCertificateProvider() throws ResourceInvalidException {
CommonTlsContext commonTlsContext = CommonTlsContext.newBuilder().setTlsCertificateCertificateProvider(CommonTlsContext.CertificateProvider.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_validationContext.
@Test
public void validateCommonTlsContext_validationContext() throws ResourceInvalidException {
CommonTlsContext commonTlsContext = CommonTlsContext.newBuilder().setValidationContext(CertificateValidationContext.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_tlsCertificateProviderInstance.
@Test
@SuppressWarnings("deprecation")
public void validateCommonTlsContext_tlsCertificateProviderInstance() throws ResourceInvalidException {
CommonTlsContext commonTlsContext = CommonTlsContext.newBuilder().setTlsCertificateCertificateProviderInstance(CertificateProviderInstance.newBuilder().setInstanceName("name1").build()).build();
ClientXdsClient.validateCommonTlsContext(commonTlsContext, ImmutableSet.of("name1", "name2"), true);
}
use of io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CommonTlsContext in project grpc-java by grpc.
the class ClientXdsClientDataTest method validateDownstreamTlsContext_hasOcspStaplePolicy.
@Test
@SuppressWarnings("deprecation")
public void validateDownstreamTlsContext_hasOcspStaplePolicy() 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).setOcspStaplePolicy(DownstreamTlsContext.OcspStaplePolicy.STRICT_STAPLING).build();
thrown.expect(ResourceInvalidException.class);
thrown.expectMessage("downstream-tls-context with ocsp_staple_policy value STRICT_STAPLING is not supported");
ClientXdsClient.validateDownstreamTlsContext(downstreamTlsContext, ImmutableSet.of(""));
}
use of io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CommonTlsContext in project grpc-java by grpc.
the class ClientXdsClientDataTest method validateCommonTlsContext_tlsNewCertificateProviderInstance.
@Test
@SuppressWarnings("deprecation")
public void validateCommonTlsContext_tlsNewCertificateProviderInstance() throws ResourceInvalidException {
CommonTlsContext commonTlsContext = CommonTlsContext.newBuilder().setTlsCertificateProviderInstance(CertificateProviderPluginInstance.newBuilder().setInstanceName("name1").build()).build();
ClientXdsClient.validateCommonTlsContext(commonTlsContext, ImmutableSet.of("name1", "name2"), true);
}
Aggregations