Search in sources :

Example 6 with IdentityProviderConfigEntityData

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

the class IdentityProviderConfigOnboardingTransactionValidatorTest method validate_shouldNotThrowExceptionWhenOnboardingTransactionEntityIsNotSpecified.

@Test
public void validate_shouldNotThrowExceptionWhenOnboardingTransactionEntityIsNotSpecified() throws Exception {
    IdentityProviderConfigEntityData identityProviderConfigEntityData = anIdentityProviderConfigData().withoutOnboarding().build();
    identityProviderConfigOnboardingTransactionValidator.validate(identityProviderConfigEntityData);
}
Also used : IdentityProviderConfigEntityData(uk.gov.ida.hub.config.domain.IdentityProviderConfigEntityData) Test(org.junit.Test)

Example 7 with IdentityProviderConfigEntityData

use of uk.gov.ida.hub.config.domain.IdentityProviderConfigEntityData 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 8 with IdentityProviderConfigEntityData

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

the class ConfigDataBootstrapTest method start_shouldThrowExceptionWhenMatchingTransactionEntityIdCheckFails.

@Test
public void start_shouldThrowExceptionWhenMatchingTransactionEntityIdCheckFails() throws Exception {
    final String transEntityId = "trans-entity-id";
    final IdentityProviderConfigEntityData identityProviderConfigData = anIdentityProviderConfigData().withEntityId("entity-id").build();
    final TransactionConfigEntityData transactionConfigData = aTransactionConfigData().withEntityId(transEntityId).withMatchingServiceEntityId(NON_EXISTENT_MATCHING_SERVICE_ENTITY_ID).build();
    final MatchingServiceConfigEntityData matchingServiceConfigData = aMatchingServiceConfigEntityData().withEntityId(MATCHING_SERVICE_ENTITY_ID).build();
    final CountriesConfigEntityData countriesConfigEntityData = new CountriesConfigEntityData() {
    };
    ConfigDataBootstrap configDataBootstrap = createConfigDataBootstrap(identityProviderConfigData, matchingServiceConfigData, transactionConfigData, countriesConfigEntityData);
    try {
        configDataBootstrap.start();
        fail("fail");
    } catch (ConfigValidationException e) {
        assertThat(e.getMessage()).isEqualTo(ConfigValidationException.createAbsentMatchingServiceConfigException(NON_EXISTENT_MATCHING_SERVICE_ENTITY_ID, transEntityId).getMessage());
    }
}
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) IdentityProviderConfigEntityData(uk.gov.ida.hub.config.domain.IdentityProviderConfigEntityData) TransactionConfigEntityData(uk.gov.ida.hub.config.domain.TransactionConfigEntityData) ConfigValidationException(uk.gov.ida.hub.config.exceptions.ConfigValidationException) Test(org.junit.Test)

Example 9 with IdentityProviderConfigEntityData

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

the class ConfigDataBootstrapTest method start_shouldThrowExceptionWhenDuplicateEntityIdsExist.

@Test
public void start_shouldThrowExceptionWhenDuplicateEntityIdsExist() throws Exception {
    final String entityId = "entity-id";
    final String matchingServiceEntityId = "matching-service-entity-id";
    final IdentityProviderConfigEntityData identityProviderConfigData = anIdentityProviderConfigData().withEntityId(entityId).build();
    final TransactionConfigEntityData transactionConfigData = aTransactionConfigData().withEntityId(entityId).withMatchingServiceEntityId(matchingServiceEntityId).build();
    final MatchingServiceConfigEntityData matchingServiceConfigData = aMatchingServiceConfigEntityData().withEntityId(matchingServiceEntityId).build();
    final CountriesConfigEntityData countriesConfigEntityData = new CountriesConfigEntityData() {
    };
    ConfigDataBootstrap configDataBootstrap = createConfigDataBootstrap(identityProviderConfigData, matchingServiceConfigData, transactionConfigData, countriesConfigEntityData);
    try {
        configDataBootstrap.start();
        fail("fail");
    } catch (ConfigValidationException e) {
        assertThat(e.getMessage()).isEqualTo(ConfigValidationException.createDuplicateEntityIdException(entityId).getMessage());
    }
}
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) IdentityProviderConfigEntityData(uk.gov.ida.hub.config.domain.IdentityProviderConfigEntityData) TransactionConfigEntityData(uk.gov.ida.hub.config.domain.TransactionConfigEntityData) ConfigValidationException(uk.gov.ida.hub.config.exceptions.ConfigValidationException) Test(org.junit.Test)

Example 10 with IdentityProviderConfigEntityData

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

the class LevelsOfAssuranceConfigValidatorTest method shouldNotThrowWhenAnIdpsIsOnboardingAndDoesNotSupportATransaction.

@Test
public void shouldNotThrowWhenAnIdpsIsOnboardingAndDoesNotSupportATransaction() {
    Set<TransactionConfigEntityData> transactionsConfig = ImmutableSet.of(loa1And2Transaction);
    final IdentityProviderConfigEntityData onboardingIdp = IdentityProviderConfigDataBuilder.anIdentityProviderConfigData().withOnboarding(ImmutableList.of("some-other-transaction-id")).withSupportedLevelsOfAssurance(ImmutableList.of(LevelOfAssurance.LEVEL_3)).build();
    Set<IdentityProviderConfigEntityData> identityProviderConfig = ImmutableSet.of(onboardingIdp, loa1And2Idp);
    try {
        levelsOfAssuranceConfigValidator.validateAllTransactionsAreSupportedByIDPs(identityProviderConfig, transactionsConfig);
    } catch (Exception e) {
        fail();
    }
}
Also used : TransactionConfigEntityData(uk.gov.ida.hub.config.domain.TransactionConfigEntityData) IdentityProviderConfigEntityData(uk.gov.ida.hub.config.domain.IdentityProviderConfigEntityData) ConfigValidationException(uk.gov.ida.hub.config.exceptions.ConfigValidationException) Test(org.junit.Test)

Aggregations

IdentityProviderConfigEntityData (uk.gov.ida.hub.config.domain.IdentityProviderConfigEntityData)17 Test (org.junit.Test)14 TransactionConfigEntityData (uk.gov.ida.hub.config.domain.TransactionConfigEntityData)9 CountriesConfigEntityData (uk.gov.ida.hub.config.domain.CountriesConfigEntityData)7 MatchingServiceConfigEntityData (uk.gov.ida.hub.config.domain.MatchingServiceConfigEntityData)6 ConfigValidationException (uk.gov.ida.hub.config.exceptions.ConfigValidationException)6 MatchingServiceConfigEntityDataBuilder.aMatchingServiceConfigEntityData (uk.gov.ida.hub.config.domain.builders.MatchingServiceConfigEntityDataBuilder.aMatchingServiceConfigEntityData)4 TypeLiteral (com.google.inject.TypeLiteral)2 ConfigDataBootstrap (uk.gov.ida.hub.config.data.ConfigDataBootstrap)2 LevelsOfAssuranceConfigValidator (uk.gov.ida.hub.config.data.LevelsOfAssuranceConfigValidator)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 GuavaModule (com.fasterxml.jackson.datatype.guava.GuavaModule)1 AbstractModule (com.google.inject.AbstractModule)1 Injector (com.google.inject.Injector)1 ConfigurationFactoryFactory (io.dropwizard.configuration.ConfigurationFactoryFactory)1 DefaultConfigurationFactoryFactory (io.dropwizard.configuration.DefaultConfigurationFactoryFactory)1 Ignore (org.junit.Ignore)1 X509CertificateFactory (uk.gov.ida.common.shared.security.X509CertificateFactory)1 OCSPPKIXParametersProvider (uk.gov.ida.common.shared.security.verification.OCSPPKIXParametersProvider)1 PKIXParametersProvider (uk.gov.ida.common.shared.security.verification.PKIXParametersProvider)1