1
0
mirror of https://github.com/google/nomulus synced 2026-01-08 07:11:44 +00:00

Add clientCertificate to TlsCredentials.toString() (#945)

* Add clientCertificate to TlsCredentials.toString()

FlowRunner.run() logs these credentials to the GAE logs by implicitly using the
toString() method, so we need to add it if we want it to appear in the logs.
This commit is contained in:
Ben McIlwain
2021-01-26 17:20:21 -05:00
committed by GitHub
parent 4e66fed497
commit a3537447ef
2 changed files with 5 additions and 2 deletions

View File

@@ -223,6 +223,7 @@ public class TlsCredentials implements TransportCredentials {
@Override
public String toString() {
return toStringHelper(getClass())
.add("clientCertificate", clientCertificate.orElse(null))
.add("clientCertificateHash", clientCertificateHash.orElse(null))
.add("clientAddress", clientInetAddr.orElse(null))
.toString();

View File

@@ -155,12 +155,14 @@ class FlowRunnerTest {
new TlsCredentials(
true,
Optional.of("abc123def"),
Optional.of("cert"),
Optional.of("cert046F5A3"),
Optional.of("127.0.0.1"),
certificateChecker);
flowRunner.run(eppMetricBuilder);
assertThat(Splitter.on("\n\t").split(findFirstLogMessageByPrefix(handler, "EPP Command\n\t")))
.contains("TlsCredentials{clientCertificateHash=abc123def, clientAddress=/127.0.0.1}");
.contains(
"TlsCredentials{clientCertificate=cert046F5A3, clientCertificateHash=abc123def,"
+ " clientAddress=/127.0.0.1}");
}
@Test