Skip to content

Commit 57b9105

Browse files
committed
interop-testing: overrideAuthority breaks JWT
Commit 65e4d9f broke the jwt_token_creds. It is believed to be because the JWT does not see the authority passed to overrideAuthority. So the changes to interop-testing client are temporarily reverted here. Note that this breaks GRPC_PROXY_EXP testing, so the incompatibility needs to be resolved. Solving grpc#2682 will allow reverting this change. Fixes grpc/grpc#9497 Fixes grpc#2680
1 parent e8aef5b commit 57b9105

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

interop-testing/src/main/java/io/grpc/testing/integration/TestServiceClient.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
import io.netty.handler.ssl.SslContext;
4444
import java.io.File;
4545
import java.io.FileInputStream;
46+
import java.net.InetAddress;
47+
import java.net.InetSocketAddress;
48+
import java.net.UnknownHostException;
4649
import java.nio.charset.Charset;
4750
import javax.net.ssl.SSLSocketFactory;
4851

@@ -301,6 +304,16 @@ private class Tester extends AbstractInteropTest {
301304
@Override
302305
protected ManagedChannel createChannel() {
303306
if (!useOkHttp) {
307+
InetAddress address;
308+
try {
309+
address = InetAddress.getByName(serverHost);
310+
if (serverHostOverride != null) {
311+
// Force the hostname to match the cert the server uses.
312+
address = InetAddress.getByAddress(serverHostOverride, address.getAddress());
313+
}
314+
} catch (UnknownHostException ex) {
315+
throw new RuntimeException(ex);
316+
}
304317
SslContext sslContext = null;
305318
if (useTestCa) {
306319
try {
@@ -310,8 +323,7 @@ protected ManagedChannel createChannel() {
310323
throw new RuntimeException(ex);
311324
}
312325
}
313-
return NettyChannelBuilder.forAddress(serverHost, serverPort)
314-
.overrideAuthority(serverHostOverride)
326+
return NettyChannelBuilder.forAddress(new InetSocketAddress(address, serverPort))
315327
.flowControlWindow(65 * 1024)
316328
.negotiationType(useTls ? NegotiationType.TLS : NegotiationType.PLAINTEXT)
317329
.sslContext(sslContext)

0 commit comments

Comments
 (0)