class CountriesService {

    public List<EidasCountryDto> getCountries(SessionId sessionId) {
        ensureTransactionSupportsEidas(sessionId);

        List<EidasCountryDto> eidasSupportedCountries = configProxy.getEidasSupportedCountries();

        String relyingPartyId = sessionRepository.getRequestIssuerEntityId(sessionId);
        List<String> rpSpecificCountries = configProxy.getEidasSupportedCountriesForRP(relyingPartyId);

        return eidasSupportedCountries.stream()
                .filter(EidasCountryDto::getEnabled)
                .filter(country -> rpSpecificCountries.isEmpty() || rpSpecificCountries.contains(country.getEntityId()))
                .collect(Collectors.toList());
    }

    @Inject public  CountriesService(SessionRepository sessionRepository, TransactionsConfigProxy configProxy);

}