Search in sources :

Example 6 with EidasCountryDto

use of uk.gov.ida.hub.policy.domain.EidasCountryDto in project verify-hub by alphagov.

the class ConfigStubRule method setUpStubForEnabledCountries.

public void setUpStubForEnabledCountries(String rpEntityId, Collection<EidasCountryDto> enabledCountries) throws JsonProcessingException {
    register(Urls.ConfigUrls.COUNTRIES_ROOT, OK, enabledCountries);
    List<String> countryEntityIds = enabledCountries.stream().map(country -> country.getEntityId()).collect(Collectors.toList());
    UriBuilder countriesForTransactionUriBuilder = UriBuilder.fromPath(Urls.ConfigUrls.EIDAS_RP_COUNTRIES_FOR_TRANSACTION_RESOURCE);
    String countriesForTransactionPath = countriesForTransactionUriBuilder.buildFromEncoded(StringEncoding.urlEncode(rpEntityId).replace("+", "%20")).getPath();
    register(countriesForTransactionPath, OK, countryEntityIds);
}
Also used : MatchingProcessDto(uk.gov.ida.hub.policy.domain.MatchingProcessDto) EidasCountryDto(uk.gov.ida.hub.policy.domain.EidasCountryDto) ExceptionType(uk.gov.ida.common.ExceptionType) IdpConfigDtoBuilder(uk.gov.ida.hub.policy.builder.domain.IdpConfigDtoBuilder) Collection(java.util.Collection) ContentType(org.apache.http.entity.ContentType) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) StringEncoding(uk.gov.ida.shared.utils.string.StringEncoding) UUID(java.util.UUID) Urls(uk.gov.ida.hub.policy.Urls) Collectors(java.util.stream.Collectors) IdpConfigDto(uk.gov.ida.hub.policy.domain.IdpConfigDto) HttpStubRule(httpstub.HttpStubRule) List(java.util.List) MatchingServiceConfigEntityDataDto(uk.gov.ida.hub.policy.contracts.MatchingServiceConfigEntityDataDto) Response(javax.ws.rs.core.Response) Optional(com.google.common.base.Optional) Arrays.asList(java.util.Arrays.asList) LevelOfAssurance(uk.gov.ida.hub.policy.domain.LevelOfAssurance) ResourceLocation(uk.gov.ida.hub.policy.domain.ResourceLocation) UriBuilder(javax.ws.rs.core.UriBuilder) ErrorStatusDto(uk.gov.ida.common.ErrorStatusDto) URI(java.net.URI) UserAccountCreationAttribute(uk.gov.ida.hub.policy.domain.UserAccountCreationAttribute) UriBuilder(javax.ws.rs.core.UriBuilder)

Example 7 with EidasCountryDto

use of uk.gov.ida.hub.policy.domain.EidasCountryDto in project verify-hub by alphagov.

the class CountrySelectedStateController method getRequestFromHub.

public AuthnRequestFromHub getRequestFromHub() {
    // Use TransactionConfigProxy to lookup list of countries and findFirst matching by entityId
    Optional<EidasCountryDto> countryDto = this.transactionsConfigProxy.getEidasSupportedCountries().stream().filter(eidasCountryDto -> eidasCountryDto.getEntityId().equals(state.getCountryEntityId())).findFirst();
    AuthnRequestFromHub requestToSendFromHub = new AuthnRequestFromHub(state.getRequestId(), state.getLevelsOfAssurance(), false, state.getCountryEntityId(), com.google.common.base.Optional.of(true), state.getSessionExpiryTimestamp(), false, countryDto.map(EidasCountryDto::getOverriddenSsoUrl).orElse(null));
    hubEventLogger.logRequestFromHub(state.getSessionId(), state.getRequestIssuerEntityId());
    return requestToSendFromHub;
}
Also used : AuthnRequestFromHub(uk.gov.ida.hub.policy.domain.AuthnRequestFromHub) ResponseFromHub(uk.gov.ida.hub.policy.domain.ResponseFromHub) SessionId(uk.gov.ida.hub.policy.domain.SessionId) StateTransitionAction(uk.gov.ida.hub.policy.domain.StateTransitionAction) TransactionsConfigProxy(uk.gov.ida.hub.policy.proxy.TransactionsConfigProxy) EidasCycle0And1MatchRequestSentState(uk.gov.ida.hub.policy.domain.state.EidasCycle0And1MatchRequestSentState) CountrySelectedState(uk.gov.ida.hub.policy.domain.state.CountrySelectedState) EidasCountryDto(uk.gov.ida.hub.policy.domain.EidasCountryDto) StateProcessingValidationException(uk.gov.ida.hub.policy.domain.exception.StateProcessingValidationException) StateController(uk.gov.ida.hub.policy.domain.StateController) HubEventLogger(uk.gov.ida.hub.policy.logging.HubEventLogger) List(java.util.List) State(uk.gov.ida.hub.policy.domain.State) EidasAttributeQueryRequestDto(uk.gov.ida.hub.policy.contracts.EidasAttributeQueryRequestDto) LevelOfAssurance(uk.gov.ida.hub.policy.domain.LevelOfAssurance) Optional(java.util.Optional) URI(java.net.URI) EidasCountryDto(uk.gov.ida.hub.policy.domain.EidasCountryDto) AuthnRequestFromHub(uk.gov.ida.hub.policy.domain.AuthnRequestFromHub)

Aggregations

EidasCountryDto (uk.gov.ida.hub.policy.domain.EidasCountryDto)7 Test (org.junit.Test)4 List (java.util.List)3 SessionId (uk.gov.ida.hub.policy.domain.SessionId)3 URI (java.net.URI)2 Optional (java.util.Optional)2 Collectors (java.util.stream.Collectors)2 Response (javax.ws.rs.core.Response)2 LevelOfAssurance (uk.gov.ida.hub.policy.domain.LevelOfAssurance)2 ResponseFromHub (uk.gov.ida.hub.policy.domain.ResponseFromHub)2 State (uk.gov.ida.hub.policy.domain.State)2 CountrySelectedState (uk.gov.ida.hub.policy.domain.state.CountrySelectedState)2 TransactionsConfigProxy (uk.gov.ida.hub.policy.proxy.TransactionsConfigProxy)2 PactVerification (au.com.dius.pact.consumer.PactVerification)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 Optional (com.google.common.base.Optional)1 HttpStubRule (httpstub.HttpStubRule)1 Arrays.asList (java.util.Arrays.asList)1 Collection (java.util.Collection)1 UUID (java.util.UUID)1