mirror of
https://github.com/google/nomulus
synced 2026-01-08 15:21:46 +00:00
Add a test of failover certificate (#2008)
Verifies that client can log in with correct failover certificate.
This commit is contained in:
@@ -17,6 +17,7 @@ package google.registry.flows;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.common.truth.Truth8.assertThat;
|
||||
import static google.registry.testing.CertificateSamples.SAMPLE_CERT;
|
||||
import static google.registry.testing.CertificateSamples.SAMPLE_CERT_HASH;
|
||||
import static google.registry.testing.DatabaseHelper.loadRegistrar;
|
||||
import static google.registry.testing.DatabaseHelper.persistResource;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
@@ -128,4 +129,18 @@ final class TlsCredentialsTest {
|
||||
// This would throw a RegistrarCertificateNotConfiguredException if cert hashes wren't bypassed.
|
||||
tls.validateCertificateHash(Registrar.loadByRegistrarId("TheRegistrar").get());
|
||||
}
|
||||
|
||||
@Test
|
||||
void test_validateCertificateHash_passWithFailOverCerticate() throws Exception {
|
||||
TlsCredentials tls =
|
||||
new TlsCredentials(
|
||||
false, Optional.of(SAMPLE_CERT_HASH), Optional.of("192.168.1.1"), certificateChecker);
|
||||
persistResource(
|
||||
loadRegistrar("TheRegistrar")
|
||||
.asBuilder()
|
||||
.setClientCertificate(null, clock.nowUtc())
|
||||
.setFailoverClientCertificate(SAMPLE_CERT, clock.nowUtc())
|
||||
.build());
|
||||
tls.validateCertificateHash(Registrar.loadByRegistrarId("TheRegistrar").get());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user