use of uk.gov.ida.hub.config.domain.TransactionConfigEntityData 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.TransactionConfigEntityData in project verify-hub by alphagov.
the class TransactionsResource method getAssertionConsumerServiceUri.
@GET
@Path(Urls.ConfigUrls.ASSERTION_CONSUMER_SERVICE_URI_PATH)
@Timed
public ResourceLocationDto getAssertionConsumerServiceUri(@PathParam(Urls.SharedUrls.ENTITY_ID_PARAM) String entityId, @QueryParam(Urls.ConfigUrls.ASSERTION_CONSUMER_SERVICE_INDEX_PARAM) Optional<Integer> assertionConsumerServiceIndex) {
final TransactionConfigEntityData configData = getTransactionConfigData(entityId);
final Optional<URI> assertionConsumerServiceUri = configData.getAssertionConsumerServiceUri(assertionConsumerServiceIndex);
if (!assertionConsumerServiceUri.isPresent()) {
// we know that the index must be here because we will have pre-validated that there will be a default for the transaction
throw exceptionFactory.createInvalidAssertionConsumerServiceIndexException(entityId, assertionConsumerServiceIndex.get());
}
return new ResourceLocationDto(assertionConsumerServiceUri.get());
}
use of uk.gov.ida.hub.config.domain.TransactionConfigEntityData in project verify-hub by alphagov.
the class TransactionsResource method getEidasCountries.
@GET
@Path(Urls.ConfigUrls.EIDAS_COUNTRIES_FOR_TRANSACTION_PATH)
@Timed
public List<String> getEidasCountries(@PathParam(Urls.SharedUrls.ENTITY_ID_PARAM) String entityId) {
final TransactionConfigEntityData configData = getTransactionConfigData(entityId);
Optional<List<String>> eidasCountries = configData.getEidasCountries();
return eidasCountries.isPresent() ? eidasCountries.get() : ImmutableList.of();
}
use of uk.gov.ida.hub.config.domain.TransactionConfigEntityData in project verify-hub by alphagov.
the class CertificateServiceTest method throwsNotFoundException_WhenEncryptionCertificateExistsButIsInvalid.
@Test(expected = NoCertificateFoundException.class)
public void throwsNotFoundException_WhenEncryptionCertificateExistsButIsInvalid() throws Exception {
TransactionConfigEntityData transactionConfigEntityData = aTransactionConfigData().withEntityId(ENTITY_ID).withEnabled(true).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(false);
certificateService.encryptionCertificateFor(ENTITY_ID);
}
use of uk.gov.ida.hub.config.domain.TransactionConfigEntityData in project verify-hub by alphagov.
the class CertificateServiceTest method findsOnlyValidSignatureVerificationCertificates_WhenTransactionSignatureCertificatesExists.
@Test
public void findsOnlyValidSignatureVerificationCertificates_WhenTransactionSignatureCertificatesExists() throws Exception {
SignatureVerificationCertificate validCert = aSignatureVerificationCertificate().withX509(CERT_ONE_X509).build();
SignatureVerificationCertificate invalidCert = aSignatureVerificationCertificate().withX509(CERT_TWO_X509).build();
TransactionConfigEntityData transactionConfigEntityData = aTransactionConfigData().withEntityId(ENTITY_ID).addSignatureVerificationCertificate(validCert).addSignatureVerificationCertificate(invalidCert).build();
CertificateDetails validCertificate = aCertifcateDetail(ENTITY_ID, validCert, FederationEntityType.RP);
CertificateDetails invalidCertificate = aCertifcateDetail(ENTITY_ID, invalidCert, FederationEntityType.RP);
when(matchingServiceDataSource.getData(ENTITY_ID)).thenReturn(Optional.empty());
when(transactionDataSource.getData(ENTITY_ID)).thenReturn(Optional.of(transactionConfigEntityData));
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);
}
Aggregations