use of uk.gov.ida.hub.config.domain.MatchingServiceConfigEntityData in project verify-hub by alphagov.
the class CertificatesResource method getCertHealthCheckDtos.
private List<CertificateHealthCheckDto> getCertHealthCheckDtos() throws CertificateException {
List<CertificateHealthCheckDto> certs = new LinkedList<>();
// IDP certs are now in the federation metadata and checked for expiry and OCSP status in separate sensu checks
for (TransactionConfigEntityData transaction : transactionDataSource.getAllData()) {
certs.add(createCertificateHealthCheckDto(transaction.getEntityId(), transaction.getEncryptionCertificate(), configuration.getCertificateWarningPeriod()));
addCertificateHealthCheckDtos(certs, transaction.getEntityId(), transaction.getSignatureVerificationCertificates());
}
for (MatchingServiceConfigEntityData ms : matchingServiceDataSource.getAllData()) {
certs.add(createCertificateHealthCheckDto(ms.getEntityId(), ms.getEncryptionCertificate(), configuration.getCertificateWarningPeriod()));
addCertificateHealthCheckDtos(certs, ms.getEntityId(), ms.getSignatureVerificationCertificates());
}
return certs;
}
use of uk.gov.ida.hub.config.domain.MatchingServiceConfigEntityData in project verify-hub by alphagov.
the class CertificateServiceTest method findsOnlyValidSignatureVerificationCertificates_WhenMatchingSignatureCertificatesExists.
@Test
public void findsOnlyValidSignatureVerificationCertificates_WhenMatchingSignatureCertificatesExists() throws Exception {
SignatureVerificationCertificate validSigCert = aSignatureVerificationCertificate().withX509(CERT_ONE_X509).build();
SignatureVerificationCertificate invalidSigCert = aSignatureVerificationCertificate().withX509(CERT_TWO_X509).build();
MatchingServiceConfigEntityData matchingServiceConfigEntityData = aMatchingServiceConfigEntityData().withEntityId(ENTITY_ID).addSignatureVerificationCertificate(validSigCert).addSignatureVerificationCertificate(invalidSigCert).build();
CertificateDetails validCertificate = new CertificateDetails(ENTITY_ID, validSigCert, FederationEntityType.MS);
CertificateDetails invalidCertificate = new CertificateDetails(ENTITY_ID, invalidSigCert, FederationEntityType.MS);
when(transactionDataSource.getData(ENTITY_ID)).thenReturn(Optional.empty());
when(matchingServiceDataSource.getData(ENTITY_ID)).thenReturn(Optional.of(matchingServiceConfigEntityData));
when(certificateValidityChecker.isValid(invalidCertificate)).thenReturn(false);
when(certificateValidityChecker.isValid(validCertificate)).thenReturn(true);
List<CertificateDetails> certificateDetailsFound = certificateService.signatureVerificatonCertificatesFor(ENTITY_ID);
assertThat(certificateDetailsFound.size()).isEqualTo(1);
assertThat(certificateDetailsFound.get(0)).isEqualTo(validCertificate);
}
use of uk.gov.ida.hub.config.domain.MatchingServiceConfigEntityData in project verify-hub by alphagov.
the class ConfigDataBootstrapTest method start_shouldOnlyValidateCertificateChainIfIdentityProviderIsEnabled.
@Test
public void start_shouldOnlyValidateCertificateChainIfIdentityProviderIsEnabled() throws Exception {
IdentityProviderConfigEntityData disabledIdp = anIdentityProviderConfigData().withEntityId("idp1EntityId").withEnabled(false).build();
MatchingServiceConfigEntityData matchingServiceConfigData = aMatchingServiceConfigEntityData().withEntityId("matchingServiceId").build();
TransactionConfigEntityData transactionConfigData = aTransactionConfigData().withMatchingServiceEntityId("matchingServiceId").withEntityId("rpEntityId").build();
CountriesConfigEntityData countriesConfigData = new CountriesConfigEntityData() {
};
ConfigDataBootstrap configDataBootstrap = createConfigDataBootstrap(disabledIdp, matchingServiceConfigData, transactionConfigData, countriesConfigData);
configDataBootstrap.start();
verify(certificateChainConfigValidator).validate(ImmutableSet.of(transactionConfigData), ImmutableSet.of(matchingServiceConfigData));
}
use of uk.gov.ida.hub.config.domain.MatchingServiceConfigEntityData in project verify-hub by alphagov.
the class MatchingServiceResource method getMatchingServices.
@GET
@Timed
public Collection<MatchingServiceConfigEntityDataDto> getMatchingServices() {
Collection<MatchingServiceConfigEntityDataDto> matchingServices = new ArrayList<>();
for (TransactionConfigEntityData transactionConfigEntityData : transactionConfigEntityDataRepository.getAllData()) {
MatchingServiceConfigEntityData matchingServiceConfigEntityData = matchingServiceConfigEntityDataRepository.getData(transactionConfigEntityData.getMatchingServiceEntityId()).get();
matchingServices.add(new MatchingServiceConfigEntityDataDto(matchingServiceConfigEntityData.getEntityId(), matchingServiceConfigEntityData.getUri(), transactionConfigEntityData.getEntityId(), matchingServiceConfigEntityData.getHealthCheckEnabled(), matchingServiceConfigEntityData.getOnboarding(), matchingServiceConfigEntityData.getUserAccountCreationUri()));
}
return matchingServices;
}
use of uk.gov.ida.hub.config.domain.MatchingServiceConfigEntityData in project verify-hub by alphagov.
the class CertificateServiceTest method throwsNoCertificateFoundException_WhenMatchingSignatureCertificatesExistButAreInvalid.
@Test(expected = NoCertificateFoundException.class)
public void throwsNoCertificateFoundException_WhenMatchingSignatureCertificatesExistButAreInvalid() throws Exception {
SignatureVerificationCertificate invalidSigCert = aSignatureVerificationCertificate().withX509(CERT_TWO_X509).build();
MatchingServiceConfigEntityData matchingServiceConfigEntityData = aMatchingServiceConfigEntityData().withEntityId(ENTITY_ID).addSignatureVerificationCertificate(invalidSigCert).build();
CertificateDetails invalidCertificate = new CertificateDetails(ENTITY_ID, invalidSigCert, FederationEntityType.MS);
when(transactionDataSource.getData(ENTITY_ID)).thenReturn(Optional.empty());
when(matchingServiceDataSource.getData(ENTITY_ID)).thenReturn(Optional.of(matchingServiceConfigEntityData));
when(certificateValidityChecker.isValid(invalidCertificate)).thenReturn(false);
certificateService.signatureVerificatonCertificatesFor(ENTITY_ID);
}
Aggregations