|
67 | 67 | import io.grpc.TlsChannelCredentials; |
68 | 68 | import io.grpc.alts.GoogleDefaultChannelCredentials; |
69 | 69 | import io.grpc.auth.MoreCallCredentials; |
70 | | -import io.grpc.util.AdvancedTlsX509KeyManager; |
71 | | -import io.grpc.util.AdvancedTlsX509TrustManager; |
72 | 70 | import java.io.File; |
73 | 71 | import java.io.IOException; |
74 | 72 | import java.lang.reflect.Method; |
|
80 | 78 | import java.util.List; |
81 | 79 | import java.util.Map; |
82 | 80 | import java.util.concurrent.Executor; |
83 | | -import java.util.concurrent.Executors; |
84 | 81 | import java.util.concurrent.ScheduledExecutorService; |
85 | 82 | import java.util.concurrent.TimeUnit; |
86 | 83 | import java.util.logging.Level; |
@@ -563,32 +560,13 @@ ChannelCredentials buildS2AChannelCredentials( |
563 | 560 | */ |
564 | 561 | @VisibleForTesting |
565 | 562 | ChannelCredentials createMtlsToS2AChannelCredentials( |
566 | | - File trustBundle, File privateKey, File certChain) |
567 | | - throws IOException, GeneralSecurityException { |
| 563 | + File trustBundle, File privateKey, File certChain) throws IOException { |
568 | 564 | if (trustBundle == null || privateKey == null || certChain == null) { |
569 | 565 | return null; |
570 | 566 | } |
571 | | - AdvancedTlsX509KeyManager keyManager = new AdvancedTlsX509KeyManager(); |
572 | | - ScheduledExecutorService keyManagerExecutor = Executors.newSingleThreadScheduledExecutor( |
573 | | - r -> { |
574 | | - Thread t = new Thread(r, "s2a-key-manager-updater"); |
575 | | - t.setDaemon(true); |
576 | | - return t; |
577 | | - }); |
578 | | - |
579 | | - keyManager.updateIdentityCredentials(certChain, privateKey, 1, TimeUnit.HOURS, keyManagerExecutor); |
580 | | - AdvancedTlsX509TrustManager trustManager = AdvancedTlsX509TrustManager.newBuilder().build(); |
581 | | - ScheduledExecutorService trustManagerExecutor = Executors.newSingleThreadScheduledExecutor( |
582 | | - r -> { |
583 | | - Thread t = new Thread(r, "s2a-trust-manager-updater"); |
584 | | - t.setDaemon(true); |
585 | | - return t; |
586 | | - }); |
587 | | - |
588 | | - trustManager.updateTrustCredentials(trustBundle, 1, TimeUnit.HOURS, trustManagerExecutor); |
589 | 567 | return TlsChannelCredentials.newBuilder() |
590 | | - .keyManager(keyManager) |
591 | | - .trustManager(trustManager) |
| 568 | + .keyManager(privateKey, certChain) |
| 569 | + .trustManager(trustBundle) |
592 | 570 | .build(); |
593 | 571 | } |
594 | 572 |
|
|
0 commit comments