@@ -221,7 +221,7 @@ public void tlsClientServer_useSystemRootCerts_noMtls_useCombinedValidationConte
221221
222222 UpstreamTlsContext upstreamTlsContext =
223223 setBootstrapInfoAndBuildUpstreamTlsContextForUsingSystemRootCerts (CLIENT_KEY_FILE ,
224- CLIENT_PEM_FILE , true , SAN_TO_MATCH , false , null );
224+ CLIENT_PEM_FILE , true , SAN_TO_MATCH , false , null , false );
225225
226226 SimpleServiceGrpc .SimpleServiceBlockingStub blockingStub =
227227 getBlockingStub (upstreamTlsContext , /* overrideAuthority= */ OVERRIDE_AUTHORITY );
@@ -248,7 +248,7 @@ public void tlsClientServer_useSystemRootCerts_noMtls_validationContext() throws
248248
249249 UpstreamTlsContext upstreamTlsContext =
250250 setBootstrapInfoAndBuildUpstreamTlsContextForUsingSystemRootCerts (CLIENT_KEY_FILE ,
251- CLIENT_PEM_FILE , false , SAN_TO_MATCH , false , null );
251+ CLIENT_PEM_FILE , false , SAN_TO_MATCH , false , null , false );
252252
253253 SimpleServiceGrpc .SimpleServiceBlockingStub blockingStub =
254254 getBlockingStub (upstreamTlsContext , /* overrideAuthority= */ OVERRIDE_AUTHORITY );
@@ -271,7 +271,7 @@ public void tlsClientServer_useSystemRootCerts_mtls() throws Exception {
271271
272272 UpstreamTlsContext upstreamTlsContext =
273273 setBootstrapInfoAndBuildUpstreamTlsContextForUsingSystemRootCerts (CLIENT_KEY_FILE ,
274- CLIENT_PEM_FILE , true , SAN_TO_MATCH , true , null );
274+ CLIENT_PEM_FILE , true , SAN_TO_MATCH , true , null , false );
275275
276276 SimpleServiceGrpc .SimpleServiceBlockingStub blockingStub =
277277 getBlockingStub (upstreamTlsContext , /* overrideAuthority= */ OVERRIDE_AUTHORITY );
@@ -299,7 +299,7 @@ public void tlsClientServer_useSystemRootCerts_noAutoSniValidation_failureToMatc
299299
300300 UpstreamTlsContext upstreamTlsContext =
301301 setBootstrapInfoAndBuildUpstreamTlsContextForUsingSystemRootCerts (CLIENT_KEY_FILE ,
302- CLIENT_PEM_FILE , true , "server1.test.google.in" , false , null );
302+ CLIENT_PEM_FILE , true , "server1.test.google.in" , false , null , false );
303303
304304 SimpleServiceGrpc .SimpleServiceBlockingStub blockingStub =
305305 getBlockingStub (upstreamTlsContext , /* overrideAuthority= */ OVERRIDE_AUTHORITY );
@@ -330,9 +330,12 @@ public void tlsClientServer_useSystemRootCerts_autoSniValidation()
330330 UpstreamTlsContext upstreamTlsContext =
331331 setBootstrapInfoAndBuildUpstreamTlsContextForUsingSystemRootCerts (CLIENT_KEY_FILE ,
332332 CLIENT_PEM_FILE , true ,
333- // won't be used
333+ // SAN matcher in CommonValidationContext. Will be overridden by autoSniSanValidation
334334 "server1.test.google.in" ,
335- false , SAN_TO_MATCH );
335+ false ,
336+ // SNI in UpstreamTlsContext
337+ SAN_TO_MATCH ,
338+ true );
336339
337340 SimpleServiceGrpc .SimpleServiceBlockingStub blockingStub =
338341 getBlockingStub (upstreamTlsContext , /* overrideAuthority= */ OVERRIDE_AUTHORITY );
@@ -359,7 +362,7 @@ public void tlsClientServer_useSystemRootCerts_requireClientAuth() throws Except
359362
360363 UpstreamTlsContext upstreamTlsContext =
361364 setBootstrapInfoAndBuildUpstreamTlsContextForUsingSystemRootCerts (CLIENT_KEY_FILE ,
362- CLIENT_PEM_FILE , true , SAN_TO_MATCH , false , null );
365+ CLIENT_PEM_FILE , true , SAN_TO_MATCH , false , null , false );
363366
364367 SimpleServiceGrpc .SimpleServiceBlockingStub blockingStub =
365368 getBlockingStub (upstreamTlsContext , /* overrideAuthority= */ OVERRIDE_AUTHORITY );
@@ -641,7 +644,11 @@ private UpstreamTlsContext setBootstrapInfoAndBuildUpstreamTlsContext(String cli
641644 private UpstreamTlsContext setBootstrapInfoAndBuildUpstreamTlsContextForUsingSystemRootCerts (
642645 String clientKeyFile ,
643646 String clientPemFile ,
644- boolean useCombinedValidationContext , String sanToMatch , boolean isMtls , String sni ) {
647+ boolean useCombinedValidationContext ,
648+ String sanToMatch ,
649+ boolean isMtls ,
650+ String sniInUpstreamTlsContext ,
651+ boolean autoSniSanValidation ) {
645652 bootstrapInfoForClient = CommonBootstrapperTestUtils
646653 .buildBootstrapInfo ("google_cloud_private_spiffe-client" , clientKeyFile , clientPemFile ,
647654 CA_PEM_FILE , null , null , null , null , null );
@@ -656,7 +663,7 @@ private UpstreamTlsContext setBootstrapInfoAndBuildUpstreamTlsContextForUsingSys
656663 .addMatchSubjectAltNames (
657664 StringMatcher .newBuilder ()
658665 .setExact (sanToMatch ))
659- .build (), sni , false );
666+ .build (), sniInUpstreamTlsContext , false , autoSniSanValidation );
660667 }
661668 return CommonTlsContextTestsUtil .buildNewUpstreamTlsContextForCertProviderInstance (
662669 "google_cloud_private_spiffe-client" , "ROOT" , null ,
0 commit comments