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);
}
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();
}
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);
}
Aggregations