Format fixes

This commit is contained in:
Sarah Botwinick 2021-01-28 18:24:58 -05:00
parent 6d47ed2861
commit 26f88bd313
3 changed files with 12 additions and 13 deletions

View file

@ -164,7 +164,7 @@ public class TlsCredentials implements TransportCredentials {
storedFailoverCert = stringToCert(registrar.getFailoverClientCertificate());
passedCert = encodedCertStringToCert(clientCertificate.get());
} catch (Exception e) {
//TODO(Sarahbot@): remove this catch once we know it's working
// TODO(Sarahbot@): remove this catch once we know it's working
logger.atWarning().log(
"Error converting certificate string to certificate for %s: %s",
registrar.getClientId(), e);
@ -198,8 +198,7 @@ public class TlsCredentials implements TransportCredentials {
// Log an error and validate using certificate hash instead
// TODO(sarahbot): throw a BadRegistrarCertificateException once hash is no longer used as
// failover
logger.atWarning().log(
"Non-matching certificate for registrar %s.", registrar.getClientId());
logger.atWarning().log("Non-matching certificate for registrar %s.", registrar.getClientId());
}
validateCertificateHash(registrar);
}

View file

@ -18,6 +18,7 @@ import static google.registry.testing.DatabaseHelper.loadRegistrar;
import static google.registry.testing.DatabaseHelper.persistResource;
import static google.registry.testing.LogsSubject.assertAboutLogs;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.joda.time.DateTimeZone.UTC;
import com.google.common.collect.ImmutableMap;
@ -47,7 +48,6 @@ import org.junit.jupiter.api.extension.RegisterExtension;
import org.testcontainers.shaded.org.bouncycastle.openssl.jcajce.JcaMiscPEMGenerator;
import org.testcontainers.shaded.org.bouncycastle.util.io.pem.PemObjectGenerator;
import org.testcontainers.shaded.org.bouncycastle.util.io.pem.PemWriter;
import static java.nio.charset.StandardCharsets.UTF_8;
/** Test logging in with TLS credentials. */
class EppLoginTlsTest extends EppTestCase {
@ -103,8 +103,8 @@ class EppLoginTlsTest extends EppTestCase {
Base64.getEncoder()
.encodeToString(
CertificateFactory.getInstance("X.509")
.generateCertificate(
new ByteArrayInputStream(CertificateSamples.SAMPLE_CERT3.getBytes(UTF_8)))
.generateCertificate(
new ByteArrayInputStream(CertificateSamples.SAMPLE_CERT3.getBytes(UTF_8)))
.getEncoded());
}
@ -230,8 +230,8 @@ class EppLoginTlsTest extends EppTestCase {
Base64.getEncoder()
.encodeToString(
CertificateFactory.getInstance("X.509")
.generateCertificate(
new ByteArrayInputStream(CertificateSamples.SAMPLE_CERT.getBytes(UTF_8)))
.generateCertificate(
new ByteArrayInputStream(CertificateSamples.SAMPLE_CERT.getBytes(UTF_8)))
.getEncoded());
// SAMPLE_CERT has a validity period that is too long
setCredentials(CertificateSamples.SAMPLE_CERT_HASH, proxyEncoded);
@ -299,8 +299,8 @@ class EppLoginTlsTest extends EppTestCase {
Base64.getEncoder()
.encodeToString(
CertificateFactory.getInstance("X.509")
.generateCertificate(
new ByteArrayInputStream(CertificateSamples.SAMPLE_CERT.getBytes(UTF_8)))
.generateCertificate(
new ByteArrayInputStream(CertificateSamples.SAMPLE_CERT.getBytes(UTF_8)))
.getEncoded());
setCredentials(null, proxyEncoded);
persistResource(

View file

@ -16,8 +16,8 @@ package google.registry.flows.session;
import static google.registry.testing.DatabaseHelper.persistResource;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import static org.joda.time.DateTimeZone.UTC;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.joda.time.DateTimeZone.UTC;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@ -68,7 +68,7 @@ public class LoginFlowViaTlsTest extends LoginFlowTestCase {
Base64.getEncoder()
.encodeToString(
CertificateFactory.getInstance("X.509")
.generateCertificate(new ByteArrayInputStream(GOOD_CERT.get().getBytes(UTF_8)))
.generateCertificate(new ByteArrayInputStream(GOOD_CERT.get().getBytes(UTF_8)))
.getEncoded());
encodedCertString = Optional.of(proxyEncoded);
}
@ -131,7 +131,7 @@ public class LoginFlowViaTlsTest extends LoginFlowTestCase {
Base64.getEncoder()
.encodeToString(
CertificateFactory.getInstance("X.509")
.generateCertificate(new ByteArrayInputStream(BAD_CERT.get().getBytes(UTF_8)))
.generateCertificate(new ByteArrayInputStream(BAD_CERT.get().getBytes(UTF_8)))
.getEncoded());
credentials =
new TlsCredentials(