use of uk.gov.ida.hub.config.domain.IdentityProviderConfig in project verify-hub by alphagov.
the class IdentityProviderConfigOnboardingTransactionValidatorTest method validate_shouldNotThrowExceptionWhenOnboardingTransactionEntityIsNotSpecified.
@Test
public void validate_shouldNotThrowExceptionWhenOnboardingTransactionEntityIsNotSpecified() {
IdentityProviderConfig identityProviderConfig = anIdentityProviderConfigData().withoutOnboarding().build();
identityProviderConfigOnboardingTransactionValidator.validate(identityProviderConfig);
}
use of uk.gov.ida.hub.config.domain.IdentityProviderConfig in project verify-hub by alphagov.
the class ConfigDataBootstrapTest method start_shouldThrowExceptionWhenOnboardingTransactionEntityIdCheckFails.
@Test
public void start_shouldThrowExceptionWhenOnboardingTransactionEntityIdCheckFails() {
final String idpEntityId = "idp-entity-id";
final String simpleId = "simple-id";
final String matchingServiceEntityId = "matching-service-entity-id";
final String nonExistentTransactionEntityId = "non-existent-transaction";
final IdentityProviderConfig identityProviderConfigData = anIdentityProviderConfigData().withEntityId(idpEntityId).withOnboarding(List.of(nonExistentTransactionEntityId)).build();
final TransactionConfig transactionConfigData = aTransactionConfigData().withEntityId("transaction-entity-id").withMatchingServiceEntityId(matchingServiceEntityId).build();
final TranslationData translationData = aTranslationData().withSimpleId(simpleId).build();
ConfigDataBootstrap configDataBootstrap = createConfigDataBootstrap(identityProviderConfigData, aMatchingServiceConfig().withEntityId(matchingServiceEntityId).build(), transactionConfigData, translationData);
try {
configDataBootstrap.start();
fail("Onboarding transaction entity id check did not fail.");
} catch (ConfigValidationException e) {
assertThat(e.getMessage()).isEqualTo(createAbsentOnboardingTransactionConfigException(nonExistentTransactionEntityId, idpEntityId).getMessage());
}
}
use of uk.gov.ida.hub.config.domain.IdentityProviderConfig 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).asEagerSingleton();
bind(TrustStoreConfiguration.class).to(ConfigConfiguration.class);
bind(new TypeLiteral<ConfigurationFactoryFactory<IdentityProviderConfig>>() {
}).toInstance(new DefaultConfigurationFactoryFactory<>());
bind(new TypeLiteral<ConfigurationFactoryFactory<TransactionConfig>>() {
}).toInstance(new DefaultConfigurationFactoryFactory<>());
bind(new TypeLiteral<ConfigurationFactoryFactory<MatchingServiceConfig>>() {
}).toInstance(new DefaultConfigurationFactoryFactory<>());
bind(new TypeLiteral<ConfigurationFactoryFactory<TranslationData>>() {
}).toInstance(new DefaultConfigurationFactoryFactory<>());
bind(new TypeLiteral<ConfigDataSource<TransactionConfig>>() {
}).to(FileBackedTransactionConfigDataSource.class).asEagerSingleton();
bind(new TypeLiteral<ConfigDataSource<TranslationData>>() {
}).to(FileBackedTranslationsDataSource.class).asEagerSingleton();
bind(new TypeLiteral<ConfigDataSource<MatchingServiceConfig>>() {
}).to(FileBackedMatchingServiceConfigDataSource.class).asEagerSingleton();
bind(new TypeLiteral<ConfigDataSource<IdentityProviderConfig>>() {
}).to(FileBackedIdentityProviderConfigDataSource.class).asEagerSingleton();
bind(new TypeLiteral<LocalConfigRepository<TransactionConfig>>() {
}).asEagerSingleton();
bind(new TypeLiteral<LocalConfigRepository<TranslationData>>() {
}).asEagerSingleton();
bind(new TypeLiteral<LocalConfigRepository<MatchingServiceConfig>>() {
}).asEagerSingleton();
bind(new TypeLiteral<LocalConfigRepository<IdentityProviderConfig>>() {
}).asEagerSingleton();
bind(new TypeLiteral<ManagedEntityConfigRepository<TransactionConfig>>() {
}).asEagerSingleton();
bind(new TypeLiteral<ManagedEntityConfigRepository<MatchingServiceConfig>>() {
}).asEagerSingleton();
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(OCSPCertificateChainValidator.class);
bind(IdpPredicateFactory.class);
bind(KeyStoreLoader.class).toInstance(new KeyStoreLoader());
bind(OCSPPKIXParametersProvider.class).toInstance(new OCSPPKIXParametersProvider());
bind(PKIXParametersProvider.class).toInstance(new PKIXParametersProvider());
}
use of uk.gov.ida.hub.config.domain.IdentityProviderConfig in project verify-hub by alphagov.
the class IdentityProviderConfigOnboardingTransactionValidatorTest method validate_shouldNotThrowExceptionWhenOnboardingTransactionEntityIdExists.
@Test
public void validate_shouldNotThrowExceptionWhenOnboardingTransactionEntityIdExists() {
String transactionEntityID = "transactionEntityID";
IdentityProviderConfig identityProviderConfig = anIdentityProviderConfigData().withOnboarding(List.of(transactionEntityID)).build();
TransactionConfig transactionConfigEntity = aTransactionConfigData().build();
when(transactionConfigRepository.getData(transactionEntityID)).thenReturn(Optional.ofNullable(transactionConfigEntity));
identityProviderConfigOnboardingTransactionValidator.validate(identityProviderConfig);
}
use of uk.gov.ida.hub.config.domain.IdentityProviderConfig in project verify-hub by alphagov.
the class IdentityProviderConfigOnboardingTransactionValidatorTest method validate_shouldThrowExceptionWhenOnboardingTransactionDoesNotExist.
@Test
public void validate_shouldThrowExceptionWhenOnboardingTransactionDoesNotExist() {
String transactionEntityID = "transactionEntityID";
String idpEntityId = "idpEntityId";
IdentityProviderConfig identityProviderConfig = anIdentityProviderConfigData().withEntityId(idpEntityId).withOnboarding(List.of(transactionEntityID)).build();
when(transactionConfigRepository.getData(transactionEntityID)).thenReturn(Optional.empty());
try {
identityProviderConfigOnboardingTransactionValidator.validate(identityProviderConfig);
fail("fail");
} catch (ConfigValidationException e) {
final ConfigValidationException expectedException = createAbsentOnboardingTransactionConfigException(transactionEntityID, idpEntityId);
assertThat(expectedException.getMessage()).isEqualTo(e.getMessage());
}
}
Aggregations