Search in sources :

Example 1 with SignatureVerificationCertificateBuilder

use of uk.gov.ida.hub.config.domain.builders.SignatureVerificationCertificateBuilder in project verify-hub by alphagov.

the class CertificateValidityCheckerTest method setUp.

@Before
public void setUp() throws Exception {
    certificateDetails = new CertificateDetails("entityId", new SignatureVerificationCertificateBuilder().build(), FederationEntityType.HUB);
    certificateValidityChecker = createNonOCSPCheckingCertificateValidityChecker(trustStoreForCertProvider, certificateChainValidator);
    when(trustStoreForCertProvider.getTrustStoreFor(certificateDetails.getFederationEntityType())).thenReturn(trustStore);
}
Also used : SignatureVerificationCertificateBuilder(uk.gov.ida.hub.config.domain.builders.SignatureVerificationCertificateBuilder) Before(org.junit.Before)

Example 2 with SignatureVerificationCertificateBuilder

use of uk.gov.ida.hub.config.domain.builders.SignatureVerificationCertificateBuilder in project verify-hub by alphagov.

the class ConfigDataBootstrapTest method continuesToStart_WhenCertificateCheckHasInvalidCertificates.

@Ignore
public void continuesToStart_WhenCertificateCheckHasInvalidCertificates() {
    final String idpEntityId = "idp-entity-id";
    final String matchingServiceId = "matching-service-id";
    final String rpEntityId = "rp-entity";
    String badCertificateValue = "badCertificate";
    final SignatureVerificationCertificate badCertificate = new SignatureVerificationCertificateBuilder().withX509(badCertificateValue).build();
    final IdentityProviderConfigEntityData identityProviderConfigData = anIdentityProviderConfigData().withEntityId(idpEntityId).addSignatureVerificationCertificate(badCertificate).build();
    MatchingServiceConfigEntityData matchingServiceConfigData = aMatchingServiceConfigEntityData().addSignatureVerificationCertificate(badCertificate).withEntityId(matchingServiceId).build();
    TransactionConfigEntityData transactionConfigData = aTransactionConfigData().withMatchingServiceEntityId(matchingServiceId).withEntityId(rpEntityId).build();
    InvalidCertificateDto invalidIdpCertificateDto = new InvalidCertificateDto(idpEntityId, CertPathValidatorException.BasicReason.INVALID_SIGNATURE, CertificateType.SIGNING, FederationEntityType.IDP, "certificate was bad!");
    InvalidCertificateDto invalidMatchingServiceCertificateDto = new InvalidCertificateDto(matchingServiceId, CertPathValidatorException.BasicReason.NOT_YET_VALID, CertificateType.SIGNING, FederationEntityType.MS, "certificate was not yet valid!");
    doThrow(createInvalidCertificatesException(ImmutableList.of(invalidMatchingServiceCertificateDto, invalidIdpCertificateDto))).when(certificateChainConfigValidator).validate(ImmutableSet.of(transactionConfigData), ImmutableSet.of(matchingServiceConfigData));
    CountriesConfigEntityData countriesConfigEntityData = createCountriesConfigEntityData();
    ConfigDataBootstrap configDataBootstrap = createConfigDataBootstrap(identityProviderConfigData, matchingServiceConfigData, transactionConfigData, countriesConfigEntityData);
    configDataBootstrap.start();
}
Also used : MatchingServiceConfigEntityData(uk.gov.ida.hub.config.domain.MatchingServiceConfigEntityData) MatchingServiceConfigEntityDataBuilder.aMatchingServiceConfigEntityData(uk.gov.ida.hub.config.domain.builders.MatchingServiceConfigEntityDataBuilder.aMatchingServiceConfigEntityData) CountriesConfigEntityData(uk.gov.ida.hub.config.domain.CountriesConfigEntityData) InvalidCertificateDto(uk.gov.ida.hub.config.dto.InvalidCertificateDto) SignatureVerificationCertificate(uk.gov.ida.hub.config.domain.SignatureVerificationCertificate) SignatureVerificationCertificateBuilder(uk.gov.ida.hub.config.domain.builders.SignatureVerificationCertificateBuilder) IdentityProviderConfigEntityData(uk.gov.ida.hub.config.domain.IdentityProviderConfigEntityData) TransactionConfigEntityData(uk.gov.ida.hub.config.domain.TransactionConfigEntityData) Ignore(org.junit.Ignore)

Example 3 with SignatureVerificationCertificateBuilder

use of uk.gov.ida.hub.config.domain.builders.SignatureVerificationCertificateBuilder in project verify-hub by alphagov.

the class SignatureVerificationCertificateTest method isX509Valid_shouldReturnNoViolationIfValueIsValid.

@Test
public void isX509Valid_shouldReturnNoViolationIfValueIsValid() throws Exception {
    final Certificate certificate = new SignatureVerificationCertificateBuilder().build();
    final Set<ConstraintViolation<Certificate>> constraintViolations = runValidations(certificate);
    assertThat(constraintViolations.size()).isEqualTo(0);
}
Also used : ConstraintViolation(javax.validation.ConstraintViolation) SignatureVerificationCertificateBuilder(uk.gov.ida.hub.config.domain.builders.SignatureVerificationCertificateBuilder) Test(org.junit.Test)

Aggregations

SignatureVerificationCertificateBuilder (uk.gov.ida.hub.config.domain.builders.SignatureVerificationCertificateBuilder)3 ConstraintViolation (javax.validation.ConstraintViolation)1 Before (org.junit.Before)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1 CountriesConfigEntityData (uk.gov.ida.hub.config.domain.CountriesConfigEntityData)1 IdentityProviderConfigEntityData (uk.gov.ida.hub.config.domain.IdentityProviderConfigEntityData)1 MatchingServiceConfigEntityData (uk.gov.ida.hub.config.domain.MatchingServiceConfigEntityData)1 SignatureVerificationCertificate (uk.gov.ida.hub.config.domain.SignatureVerificationCertificate)1 TransactionConfigEntityData (uk.gov.ida.hub.config.domain.TransactionConfigEntityData)1 MatchingServiceConfigEntityDataBuilder.aMatchingServiceConfigEntityData (uk.gov.ida.hub.config.domain.builders.MatchingServiceConfigEntityDataBuilder.aMatchingServiceConfigEntityData)1 InvalidCertificateDto (uk.gov.ida.hub.config.dto.InvalidCertificateDto)1