use of uk.gov.ida.hub.config.domain.MatchingServiceConfigEntityData 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());
}
}
use of uk.gov.ida.hub.config.domain.MatchingServiceConfigEntityData in project verify-hub by alphagov.
the class TransactionConfigMatchingServiceValidatorTest method matchingServiceEntityId_shouldHaveCorrespondingConfiguration.
@Test
public void matchingServiceEntityId_shouldHaveCorrespondingConfiguration() throws Exception {
final String matchingServiceEntityId = "matching-service-entity-id";
TransactionConfigEntityData transactionConfig = aTransactionConfigData().withMatchingServiceEntityId(matchingServiceEntityId).build();
MatchingServiceConfigEntityData matchingServiceConfigData = aMatchingServiceConfigEntityData().withEntityId(matchingServiceEntityId).build();
when(matchingServiceConfigEntityDataRepository.getData(matchingServiceEntityId)).thenReturn(Optional.ofNullable(matchingServiceConfigData));
validator.validate(transactionConfig, matchingServiceConfigEntityDataRepository);
}
use of uk.gov.ida.hub.config.domain.MatchingServiceConfigEntityData in project verify-hub by alphagov.
the class ConfigModule method configure.
@Override
protected void configure() {
bind(ConfigHealthCheck.class).asEagerSingleton();
bind(ConfigDataBootstrap.class).asEagerSingleton();
bind(CertificateChainConfigValidator.class).annotatedWith(CertificateConfigValidator.class).to(LoggingCertificateChainConfigValidator.class);
bind(TrustStoreConfiguration.class).to(ConfigConfiguration.class);
bind(new TypeLiteral<ConfigurationFactoryFactory<IdentityProviderConfigEntityData>>() {
}).toInstance(new DefaultConfigurationFactoryFactory<IdentityProviderConfigEntityData>());
bind(new TypeLiteral<ConfigurationFactoryFactory<TransactionConfigEntityData>>() {
}).toInstance(new DefaultConfigurationFactoryFactory<TransactionConfigEntityData>());
bind(new TypeLiteral<ConfigurationFactoryFactory<MatchingServiceConfigEntityData>>() {
}).toInstance(new DefaultConfigurationFactoryFactory<MatchingServiceConfigEntityData>());
bind(new TypeLiteral<ConfigurationFactoryFactory<CountriesConfigEntityData>>() {
}).toInstance(new DefaultConfigurationFactoryFactory<CountriesConfigEntityData>());
bind(new TypeLiteral<ConfigDataSource<TransactionConfigEntityData>>() {
}).to(FileBackedTransactionConfigDataSource.class).asEagerSingleton();
bind(new TypeLiteral<ConfigDataSource<MatchingServiceConfigEntityData>>() {
}).to(FileBackedMatchingServiceConfigDataSource.class).asEagerSingleton();
bind(new TypeLiteral<ConfigDataSource<IdentityProviderConfigEntityData>>() {
}).to(FileBackedIdentityProviderConfigDataSource.class).asEagerSingleton();
bind(new TypeLiteral<ConfigDataSource<CountriesConfigEntityData>>() {
}).to(FileBackedCountriesConfigDataSource.class).asEagerSingleton();
bind(new TypeLiteral<ConfigEntityDataRepository<TransactionConfigEntityData>>() {
}).asEagerSingleton();
bind(new TypeLiteral<ConfigEntityDataRepository<CountriesConfigEntityData>>() {
}).asEagerSingleton();
bind(new TypeLiteral<ConfigEntityDataRepository<MatchingServiceConfigEntityData>>() {
}).asEagerSingleton();
bind(new TypeLiteral<ConfigEntityDataRepository<IdentityProviderConfigEntityData>>() {
}).asEagerSingleton();
bind(ObjectMapper.class).toInstance(new ObjectMapper().registerModule(new GuavaModule()));
bind(LevelsOfAssuranceConfigValidator.class).toInstance(new LevelsOfAssuranceConfigValidator());
bind(CertificateChainValidator.class);
bind(TrustStoreForCertificateProvider.class);
bind(X509CertificateFactory.class).toInstance(new X509CertificateFactory());
bind(KeyStoreCache.class);
bind(ExceptionFactory.class);
bind(OCSPCertificateChainValidityChecker.class);
bind(EntityConfigDataToCertificateDtoTransformer.class);
bind(OCSPCertificateChainValidator.class);
bind(IdpPredicateFactory.class);
bind(KeyStoreLoader.class).toInstance(new KeyStoreLoader());
bind(OCSPPKIXParametersProvider.class).toInstance(new OCSPPKIXParametersProvider());
bind(PKIXParametersProvider.class).toInstance(new PKIXParametersProvider());
bind(CertificateService.class);
}
use of uk.gov.ida.hub.config.domain.MatchingServiceConfigEntityData in project verify-hub by alphagov.
the class ConfigValidCommand method run.
@Override
public void run(Bootstrap<ConfigConfiguration> bootstrap, Namespace namespace, ConfigConfiguration configuration) throws Exception {
Injector injector = Guice.createInjector(new AbstractModule() {
@Override
protected void configure() {
bind(new TypeLiteral<ConfigurationFactoryFactory<IdentityProviderConfigEntityData>>() {
}).toInstance(new DefaultConfigurationFactoryFactory<>());
bind(new TypeLiteral<ConfigurationFactoryFactory<MatchingServiceConfigEntityData>>() {
}).toInstance(new DefaultConfigurationFactoryFactory<>());
bind(new TypeLiteral<ConfigurationFactoryFactory<TransactionConfigEntityData>>() {
}).toInstance(new DefaultConfigurationFactoryFactory<>());
bind(new TypeLiteral<ConfigurationFactoryFactory<CountriesConfigEntityData>>() {
}).toInstance(new DefaultConfigurationFactoryFactory<>());
bind(new TypeLiteral<ConfigDataSource<TransactionConfigEntityData>>() {
}).to(FileBackedTransactionConfigDataSource.class).asEagerSingleton();
bind(new TypeLiteral<ConfigDataSource<MatchingServiceConfigEntityData>>() {
}).to(FileBackedMatchingServiceConfigDataSource.class).asEagerSingleton();
bind(new TypeLiteral<ConfigDataSource<IdentityProviderConfigEntityData>>() {
}).to(FileBackedIdentityProviderConfigDataSource.class).asEagerSingleton();
bind(new TypeLiteral<ConfigDataSource<CountriesConfigEntityData>>() {
}).to(FileBackedCountriesConfigDataSource.class).asEagerSingleton();
bind(new TypeLiteral<ConfigEntityDataRepository<TransactionConfigEntityData>>() {
}).asEagerSingleton();
bind(new TypeLiteral<ConfigEntityDataRepository<CountriesConfigEntityData>>() {
}).asEagerSingleton();
bind(new TypeLiteral<ConfigEntityDataRepository<MatchingServiceConfigEntityData>>() {
}).asEagerSingleton();
bind(new TypeLiteral<ConfigEntityDataRepository<IdentityProviderConfigEntityData>>() {
}).asEagerSingleton();
bind(ConfigConfiguration.class).toInstance(configuration);
bind(LevelsOfAssuranceConfigValidator.class).toInstance(new LevelsOfAssuranceConfigValidator());
bind(TrustStoreConfiguration.class).to(ConfigConfiguration.class);
bind(TrustStoreForCertificateProvider.class);
bind(CertificateChainConfigValidator.class).annotatedWith(CertificateConfigValidator.class).to(ThrowingCertificateChainConfigValidator.class);
}
});
ConfigDataBootstrap checkConfigValid = injector.getInstance(ConfigDataBootstrap.class);
try {
checkConfigValid.start();
} catch (ConfigValidationException e) {
LOG.info(e.getMessage());
throw e;
}
}
Aggregations