use of uk.gov.ida.hub.config.domain.IdentityProviderConfigEntityData in project verify-hub by alphagov.
the class ConfigDataBootstrapTest method start_shouldOnlyValidateCertificateChainIfIdentityProviderIsEnabled.
@Test
public void start_shouldOnlyValidateCertificateChainIfIdentityProviderIsEnabled() throws Exception {
IdentityProviderConfigEntityData disabledIdp = anIdentityProviderConfigData().withEntityId("idp1EntityId").withEnabled(false).build();
MatchingServiceConfigEntityData matchingServiceConfigData = aMatchingServiceConfigEntityData().withEntityId("matchingServiceId").build();
TransactionConfigEntityData transactionConfigData = aTransactionConfigData().withMatchingServiceEntityId("matchingServiceId").withEntityId("rpEntityId").build();
CountriesConfigEntityData countriesConfigData = new CountriesConfigEntityData() {
};
ConfigDataBootstrap configDataBootstrap = createConfigDataBootstrap(disabledIdp, matchingServiceConfigData, transactionConfigData, countriesConfigData);
configDataBootstrap.start();
verify(certificateChainConfigValidator).validate(ImmutableSet.of(transactionConfigData), ImmutableSet.of(matchingServiceConfigData));
}
use of uk.gov.ida.hub.config.domain.IdentityProviderConfigEntityData in project verify-hub by alphagov.
the class ConfigDataBootstrapTest method start_shouldThrowExceptionWhenOnboardingTransactionEntityIdCheckFails.
@Test
public void start_shouldThrowExceptionWhenOnboardingTransactionEntityIdCheckFails() throws Exception {
final String idpEntityId = "idp-entity-id";
final String matchingServiceEntityId = "matching-service-entity-id";
final String nonExistentTransactionEntityId = "non-existent-transaction";
final IdentityProviderConfigEntityData identityProviderConfigData = anIdentityProviderConfigData().withEntityId(idpEntityId).withOnboarding(ImmutableList.of(nonExistentTransactionEntityId)).build();
final TransactionConfigEntityData transactionConfigData = aTransactionConfigData().withEntityId("transaction-entity-id").withMatchingServiceEntityId(matchingServiceEntityId).build();
final CountriesConfigEntityData countriesConfigEntityData = new CountriesConfigEntityData() {
};
ConfigDataBootstrap configDataBootstrap = createConfigDataBootstrap(identityProviderConfigData, aMatchingServiceConfigEntityData().withEntityId(matchingServiceEntityId).build(), transactionConfigData, countriesConfigEntityData);
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.IdentityProviderConfigEntityData in project verify-hub by alphagov.
the class EnabledIdpPredicateTest method shouldBeTrueForEnabled.
@Test
public void shouldBeTrueForEnabled() throws Exception {
Predicate<IdentityProviderConfigEntityData> enabledPredicate = new EnabledIdpPredicate();
IdentityProviderConfigEntityData enabledIdp = anIdentityProviderConfigData().withEnabled(true).build();
assertThat(enabledPredicate.apply(enabledIdp)).isTrue();
}
use of uk.gov.ida.hub.config.domain.IdentityProviderConfigEntityData in project verify-hub by alphagov.
the class IdpEntityIdExtractorTest method apply_shouldReturnEntityId.
@Test
public void apply_shouldReturnEntityId() throws Exception {
IdentityProviderConfigEntityData identityProviderConfigEntityData = mock(IdentityProviderConfigEntityData.class);
String idpEntityId = "idp entity id";
when(identityProviderConfigEntityData.getEntityId()).thenReturn(idpEntityId);
IdpEntityIdExtractor idpEntityIdExtractor = new IdpEntityIdExtractor();
String extractedEntityId = idpEntityIdExtractor.apply(identityProviderConfigEntityData);
assertThat(extractedEntityId).isEqualTo(idpEntityId);
}
use of uk.gov.ida.hub.config.domain.IdentityProviderConfigEntityData in project verify-hub by alphagov.
the class OnboardingForTransactionEntityPredicateTest method shouldBeTrueForOnboardingForSameTransactionEntity.
@Test
public void shouldBeTrueForOnboardingForSameTransactionEntity() {
String transactionEntity = "transactionEntity";
Predicate<IdentityProviderConfigEntityData> onboardingPredicate = new OnboardingForTransactionEntityPredicate(transactionEntity);
IdentityProviderConfigEntityData onboardingSameTransactionEntityIdp = anIdentityProviderConfigData().withOnboarding(ImmutableList.of(transactionEntity)).build();
assertThat(onboardingPredicate.apply(onboardingSameTransactionEntityIdp)).isTrue();
}
Aggregations