Search in sources :

Example 11 with IdentityProviderConfigEntityData

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

the class EnabledIdpPredicateTest method shouldBeFalseForDisabled.

@Test
public void shouldBeFalseForDisabled() throws Exception {
    Predicate<IdentityProviderConfigEntityData> enabledPredicate = new EnabledIdpPredicate();
    IdentityProviderConfigEntityData disabledIdp = anIdentityProviderConfigData().withEnabled(false).build();
    assertThat(enabledPredicate.apply(disabledIdp)).isFalse();
}
Also used : IdentityProviderConfigEntityData(uk.gov.ida.hub.config.domain.IdentityProviderConfigEntityData) Test(org.junit.Test)

Example 12 with IdentityProviderConfigEntityData

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

the class OnboardingForTransactionEntityPredicateTest method shouldBeTrueForNonOnboarding.

@Test
public void shouldBeTrueForNonOnboarding() {
    String transactionEntity = "transactionEntity";
    Predicate<IdentityProviderConfigEntityData> onboardingPredicate = new OnboardingForTransactionEntityPredicate(transactionEntity);
    IdentityProviderConfigEntityData nonOnboardingIdp = anIdentityProviderConfigData().build();
    assertThat(onboardingPredicate.apply(nonOnboardingIdp)).isTrue();
}
Also used : IdentityProviderConfigEntityData(uk.gov.ida.hub.config.domain.IdentityProviderConfigEntityData) Test(org.junit.Test)

Example 13 with IdentityProviderConfigEntityData

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

the class OnboardingForTransactionEntityPredicateTest method shouldBeFalseForOnboardingDifferentTransactionEntity.

@Test
public void shouldBeFalseForOnboardingDifferentTransactionEntity() {
    String transactionEntity = "transactionEntity";
    List<String> differentTransactionEntity = ImmutableList.of("differentTransactionEntity");
    Predicate<IdentityProviderConfigEntityData> onboardingPredicate = new OnboardingForTransactionEntityPredicate(transactionEntity);
    IdentityProviderConfigEntityData onboardingDifferentTransactionEntityIdp = anIdentityProviderConfigData().withOnboarding(differentTransactionEntity).build();
    assertThat(onboardingPredicate.apply(onboardingDifferentTransactionEntityIdp)).isFalse();
}
Also used : IdentityProviderConfigEntityData(uk.gov.ida.hub.config.domain.IdentityProviderConfigEntityData) Test(org.junit.Test)

Example 14 with IdentityProviderConfigEntityData

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

the class IdentityProviderConfigOnboardingTransactionValidatorTest method validate_shouldNotThrowExceptionWhenOnboardingTransactionEntityIdExists.

@Test
public void validate_shouldNotThrowExceptionWhenOnboardingTransactionEntityIdExists() throws Exception {
    String transactionEntityID = "transactionEntityID";
    IdentityProviderConfigEntityData identityProviderConfigEntityData = anIdentityProviderConfigData().withOnboarding(ImmutableList.of(transactionEntityID)).build();
    TransactionConfigEntityData transactionConfigEntity = aTransactionConfigData().build();
    when(transactionConfigEntityDataConfigEntityDataRepository.getData(transactionEntityID)).thenReturn(Optional.ofNullable(transactionConfigEntity));
    identityProviderConfigOnboardingTransactionValidator.validate(identityProviderConfigEntityData);
}
Also used : IdentityProviderConfigEntityData(uk.gov.ida.hub.config.domain.IdentityProviderConfigEntityData) TransactionConfigEntityData(uk.gov.ida.hub.config.domain.TransactionConfigEntityData) Test(org.junit.Test)

Example 15 with IdentityProviderConfigEntityData

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

the class IdentityProviderConfigOnboardingTransactionValidatorTest method validate_shouldThrowExceptionWhenOnboardingTransactionDoesNotExist.

@Test
public void validate_shouldThrowExceptionWhenOnboardingTransactionDoesNotExist() throws Exception {
    String transactionEntityID = "transactionEntityID";
    String idpEntityId = "idpEntityId";
    IdentityProviderConfigEntityData identityProviderConfigEntityData = anIdentityProviderConfigData().withEntityId(idpEntityId).withOnboarding(ImmutableList.of(transactionEntityID)).build();
    when(transactionConfigEntityDataConfigEntityDataRepository.getData(transactionEntityID)).thenReturn(Optional.empty());
    try {
        identityProviderConfigOnboardingTransactionValidator.validate(identityProviderConfigEntityData);
        fail("fail");
    } catch (ConfigValidationException e) {
        final ConfigValidationException expectedException = createAbsentOnboardingTransactionConfigException(transactionEntityID, idpEntityId);
        assertThat(expectedException.getMessage()).isEqualTo(e.getMessage());
    }
}
Also used : 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