Skip to content

Commit

Permalink
address review comments: fix useTransportSecurity
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjaypujare committed Nov 18, 2020
1 parent a07fab8 commit d52274b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions xds/src/main/java/io/grpc/xds/XdsServerBuilder.java
Expand Up @@ -118,13 +118,21 @@ public XdsServerBuilder fallbackHandlerRegistry(@Nullable HandlerRegistry fallba

@Override
public XdsServerBuilder useTransportSecurity(File certChain, File privateKey) {
delegate.useTransportSecurity(certChain, privateKey);
try {
this.serverCredentials = TlsServerCredentials.create(certChain, privateKey);
} catch (IOException e) {
throw new RuntimeException(e);
}
return this;
}

@Override
public XdsServerBuilder useTransportSecurity(InputStream certChain, InputStream privateKey) {
delegate.useTransportSecurity(certChain, privateKey);
try {
this.serverCredentials = TlsServerCredentials.create(certChain, privateKey);
} catch (IOException e) {
throw new RuntimeException(e);
}
return this;
}

Expand All @@ -134,7 +142,7 @@ public XdsServerBuilder useTransportSecurity(InputStream certChain, InputStream
*/
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/7514")
public XdsServerBuilder useXdsSecurityWithPlaintextFallback() {
this.serverCredentials = InsecureServerCredentials.create();
this.serverCredentials = XdsServerCredentials.create(InsecureServerCredentials.create());
return this;
}

Expand Down

0 comments on commit d52274b

Please sign in to comment.