use of uk.gov.ida.hub.config.domain.CertificateDetails in project verify-hub by alphagov.
the class CertificateServiceTest method findsSignatureVerificationCertificates_WhenMatchingSignatureCertificatesExists.
@Test
public void findsSignatureVerificationCertificates_WhenMatchingSignatureCertificatesExists() throws Exception {
SignatureVerificationCertificate sigCert1 = aSignatureVerificationCertificate().withX509(CERT_ONE_X509).build();
SignatureVerificationCertificate sigCert2 = aSignatureVerificationCertificate().withX509(CERT_TWO_X509).build();
MatchingServiceConfigEntityData matchingServiceConfigEntityData = aMatchingServiceConfigEntityData().withEntityId(ENTITY_ID).addSignatureVerificationCertificate(sigCert1).addSignatureVerificationCertificate(sigCert2).build();
when(transactionDataSource.getData(ENTITY_ID)).thenReturn(Optional.empty());
when(matchingServiceDataSource.getData(ENTITY_ID)).thenReturn(Optional.of(matchingServiceConfigEntityData));
when(certificateValidityChecker.isValid(any(CertificateDetails.class))).thenReturn(true);
List<CertificateDetails> certificateDetailsFound = certificateService.signatureVerificatonCertificatesFor(ENTITY_ID);
assertThat(certificateDetailsFound.size()).isEqualTo(2);
assertThat(certificateDetailsFound).contains(aCertifcateDetail(ENTITY_ID, sigCert1, FederationEntityType.MS), aCertifcateDetail(ENTITY_ID, sigCert2, FederationEntityType.MS));
}
use of uk.gov.ida.hub.config.domain.CertificateDetails in project verify-hub by alphagov.
the class CertificateServiceTest method findsSignatureVerificationCertificates_WhenTransactionSignatureCertificatesExists.
@Test
public void findsSignatureVerificationCertificates_WhenTransactionSignatureCertificatesExists() throws Exception {
SignatureVerificationCertificate sigCert1 = aSignatureVerificationCertificate().withX509(CERT_ONE_X509).build();
SignatureVerificationCertificate sigCert2 = aSignatureVerificationCertificate().withX509(CERT_TWO_X509).build();
TransactionConfigEntityData transactionConfigEntityData = aTransactionConfigData().withEntityId(ENTITY_ID).addSignatureVerificationCertificate(sigCert1).addSignatureVerificationCertificate(sigCert2).build();
when(matchingServiceDataSource.getData(ENTITY_ID)).thenReturn(Optional.empty());
when(transactionDataSource.getData(ENTITY_ID)).thenReturn(Optional.of(transactionConfigEntityData));
when(certificateValidityChecker.isValid(any(CertificateDetails.class))).thenReturn(true);
List<CertificateDetails> certificateDetailsFound = certificateService.signatureVerificatonCertificatesFor(ENTITY_ID);
assertThat(certificateDetailsFound.size()).isEqualTo(2);
assertThat(certificateDetailsFound).contains(aCertifcateDetail(ENTITY_ID, sigCert1, FederationEntityType.RP), aCertifcateDetail(ENTITY_ID, sigCert2, FederationEntityType.RP));
}
Aggregations