From 6e1a69773284177a0f6c7233c4bcdf7f4bd96681 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Tue, 15 Jun 2021 18:15:19 +0200 Subject: further optimizations and bug fixing in matching code --- .../eidas/specific/connector/provider/StatusMessageProvider.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'connector/src/main/java/at/asitplus') diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java index 073f7513..55ce044d 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/provider/StatusMessageProvider.java @@ -92,14 +92,12 @@ public class StatusMessageProvider implements IStatusMessenger { @Override public String getResponseErrorCode(Throwable throwable) { - String errorCode = IStatusMessenger.CODES_EXTERNAL_ERROR_GENERIC; if (throwable instanceof EaafException) { - errorCode = mapInternalErrorToExternalError(((EaafException) throwable).getErrorId()); - + return ((EaafException) throwable).getErrorId(); + } - // TODO: maybe more internal switches are required - return errorCode; + return IStatusMessenger.CODES_INTERNAL_ERROR_GENERIC; } -- cgit v1.2.3 From cbf1d0408519d0763a1a87b733c16a1ba5d022ba Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Wed, 7 Jul 2021 09:31:43 +0200 Subject: add HTML template for additional eID information --- .../config/StaticResourceConfiguration.java | 207 --------------------- .../controller/ProcessEngineSignalController.java | 3 +- 2 files changed, 2 insertions(+), 208 deletions(-) delete mode 100644 connector/src/main/java/at/asitplus/eidas/specific/connector/config/StaticResourceConfiguration.java (limited to 'connector/src/main/java/at/asitplus') diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/config/StaticResourceConfiguration.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/config/StaticResourceConfiguration.java deleted file mode 100644 index a1e953f1..00000000 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/config/StaticResourceConfiguration.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright 2019 A-SIT Plus GmbH - * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ, - * A-SIT Plus GmbH, A-SIT, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "License"); - * You may not use this work except in compliance with the License. - * You may obtain a copy of the License at: - * https://joinup.ec.europa.eu/news/understanding-eupl-v12 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - -package at.asitplus.eidas.specific.connector.config; - -import java.net.MalformedURLException; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.support.ReloadableResourceBundleMessageSource; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import org.thymeleaf.templateresolver.FileTemplateResolver; - -import at.asitplus.eidas.specific.connector.MsEidasNodeConstants; -import at.gv.egiz.eaaf.core.api.idp.IConfiguration; -import at.gv.egiz.eaaf.core.api.logging.IMessageSourceLocation; -import at.gv.egiz.eaaf.core.impl.utils.FileUtils; - -/** - * Spring configurator for Web resources. - * - * @author tlenz - * - */ -@Configuration -@EnableWebMvc -public class StaticResourceConfiguration implements WebMvcConfigurer { - private static final Logger log = LoggerFactory.getLogger(StaticResourceConfiguration.class); - private static final String[] CLASSPATH_RESOURCE_LOCATIONS = { - "/" - }; - - private static final String DEFAULT_MESSAGE_SOURCE = "classpath:properties/status_messages"; - - @Autowired - private IConfiguration basicConfig; - - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - final String staticResources = basicConfig.getBasicConfiguration( - MsEidasNodeConstants.PROP_CONFIG_WEBCONTENT_STATIC_PATH); - try { - if (StringUtils.isNotEmpty(staticResources)) { - String absPath = FileUtils.makeAbsoluteUrl(staticResources, basicConfig - .getConfigurationRootDirectory()); - if (!absPath.endsWith("/")) { - absPath += "/"; - } - - registry.addResourceHandler("/static/**").addResourceLocations(absPath); - log.info("Add Ressourcefolder: " + absPath + " for static Web content"); - - } else { - log.debug("No Ressourcefolder for static Web content"); - } - - } catch (final MalformedURLException e) { - log.warn("Can NOT initialize ressourcefolder for static Web content", e); - - } - - registry.addResourceHandler("/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS); - - } - - /** - * Get a message source with only internal message properties. - * - * @param ressourceLocations List of source-locations - * @return - */ - @Bean - public ReloadableResourceBundleMessageSource internalMessageSource( - @Autowired(required = false) final List ressourceLocations) { - final ReloadableResourceBundleMessageSource messageSource = - new ReloadableResourceBundleMessageSource(); - - // add default message source - messageSource.setBasename(DEFAULT_MESSAGE_SOURCE); - - if (ressourceLocations != null) { - // load more message sources - for (final IMessageSourceLocation el : ressourceLocations) { - if (el.getMessageSourceLocation() != null) { - for (final String source : el.getMessageSourceLocation()) { - messageSource.addBasenames(source); - log.debug("Add additional messageSources: {}", el.getMessageSourceLocation().toArray()); - - } - } - } - } - - messageSource.setDefaultEncoding("UTF-8"); - return messageSource; - - } - - /** - * Get full message source with internal and external message-properties files. - * - * @param ressourceLocations List of source-locations - * @return - */ - @Bean - public ReloadableResourceBundleMessageSource messageSource( - @Autowired(required = false) final List ressourceLocations) { - final ReloadableResourceBundleMessageSource messageSource = - new ReloadableResourceBundleMessageSource(); - messageSource.setDefaultEncoding("UTF-8"); - messageSource.setParentMessageSource(internalMessageSource(ressourceLocations)); - - final String staticResources = basicConfig - .getBasicConfiguration(MsEidasNodeConstants.PROP_CONFIG_WEBCONTENT_PROPERTIES_PATH); - try { - if (StringUtils.isNotEmpty(staticResources)) { - final String absPath = - FileUtils.makeAbsoluteUrl(staticResources, basicConfig.getConfigurationRootDirectory()); - messageSource.setBasename(absPath); - - } else { - log.debug("No Ressourcefolder for dynamic Web content templates"); - - } - - } catch (final MalformedURLException e) { - log.warn("Can NOT initialize ressourcefolder for dynamic Web content templates", e); - - } - - return messageSource; - - } - - /** - * Get a Tyhmeleaf Template-Resolver with external configuration path. - * - * @return - */ - @Bean(name = "templateResolver") - public FileTemplateResolver templateResolver() { - final String staticResources = basicConfig - .getBasicConfiguration(MsEidasNodeConstants.PROP_CONFIG_WEBCONTENT_TEMPLATES_PATH); - try { - if (StringUtils.isNotEmpty(staticResources)) { - String absPath = - FileUtils.makeAbsoluteUrl(staticResources, basicConfig.getConfigurationRootDirectory()); - if (!absPath.endsWith("/")) { - absPath += "/"; - - } - - if (absPath.startsWith("file:")) { - absPath = absPath.substring("file:".length()); - - } - - final FileTemplateResolver viewResolver = new FileTemplateResolver(); - viewResolver.setPrefix(absPath); - viewResolver.setSuffix(".html"); - viewResolver.setTemplateMode("HTML"); - viewResolver.setCacheable(false); - - log.info("Add Ressourcefolder: {} for dynamic Web content templates", absPath); - return viewResolver; - - } else { - log.debug("No Ressourcefolder for dynamic Web content templates"); - - } - - } catch (final MalformedURLException e) { - log.warn("Can NOT initialize ressourcefolder for dynamic Web content templates", e); - - } - - throw new RuntimeException("Can NOT initialize HTML template resolver"); - - } -} diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/ProcessEngineSignalController.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/ProcessEngineSignalController.java index 1bf1ad67..6e2879a8 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/ProcessEngineSignalController.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/ProcessEngineSignalController.java @@ -46,7 +46,8 @@ import at.gv.egiz.eaaf.core.impl.idp.controller.AbstractProcessEngineSignalContr public class ProcessEngineSignalController extends AbstractProcessEngineSignalController { @RequestMapping(value = { - MsEidasNodeConstants.ENDPOINT_COUNTRYSELECTION + MsEidasNodeConstants.ENDPOINT_COUNTRYSELECTION, + MsEidasNodeConstants.ENDPOINT_OTHER_LOGIN_METHOD_SELECTION }, method = { RequestMethod.POST, RequestMethod.GET }) public void performGenericAuthenticationProcess(HttpServletRequest req, HttpServletResponse resp) -- cgit v1.2.3 From 401cd39689d73f1cc865bb3c7cfca40a3f5ac625 Mon Sep 17 00:00:00 2001 From: Christian Kollmann Date: Wed, 1 Dec 2021 14:46:18 +0100 Subject: Add simple page to search for an Austrian Address --- .../controller/AdresssucheController.java | 131 +++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java (limited to 'connector/src/main/java/at/asitplus') diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java new file mode 100644 index 00000000..35f56012 --- /dev/null +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java @@ -0,0 +1,131 @@ +/* + * Copyright 2018 A-SIT Plus GmbH + * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ, + * A-SIT Plus GmbH, A-SIT, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "License"); + * You may not use this work except in compliance with the License. + * You may obtain a copy of the License at: + * https://joinup.ec.europa.eu/news/understanding-eupl-v12 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + +package at.asitplus.eidas.specific.connector.controller; + +import at.asitplus.eidas.specific.connector.MsEidasNodeConstants; +import at.asitplus.eidas.specific.connector.gui.StaticGuiBuilderConfiguration; +import at.gv.egiz.eaaf.core.api.gui.IGuiBuilderConfiguration; +import at.gv.egiz.eaaf.core.api.gui.ISpringMvcGuiFormBuilder; +import at.gv.egiz.eaaf.core.api.idp.IConfiguration; +import at.gv.egiz.eaaf.core.api.utils.IPendingRequestIdGenerationStrategy; +import at.gv.egiz.eaaf.core.exceptions.GuiBuildException; +import at.gv.egiz.eaaf.core.exceptions.PendingReqIdValidationException; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.ResourceLoader; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * Default process-engine signaling controller. + * + * @author tlenz + */ +@Controller +@Slf4j +public class AdresssucheController { + + @Autowired + private ISpringMvcGuiFormBuilder guiBuilder; + + @Autowired + private IConfiguration basicConfig; + + @Autowired + private ResourceLoader resourceLoader; + + @Autowired + private IPendingRequestIdGenerationStrategy pendingReqGeneration; + + @RequestMapping(value = {"/test"}, method = {RequestMethod.GET}) + public void test(HttpServletRequest request, HttpServletResponse response) throws GuiBuildException { + final IGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( + basicConfig, + "http://localhost:8080/ms_connector/", + basicConfig.getBasicConfiguration(//TODO + MsEidasNodeConstants.PROP_CONFIG_WEBCONTENT_TEMPLATES_RESIDENCY, + MsEidasNodeConstants.TEMPLATE_HTML_RESIDENCY), + MsEidasNodeConstants.ENDPOINT_RESIDENCY_INPUT, + resourceLoader); + // TODO Set the pendingId somehow + guiBuilder.build(request, response, config, "Query Austrian residency"); + } + + @RequestMapping(value = {"/residency/search"}, method = {RequestMethod.POST}) + public ResponseEntity search(@RequestParam("city") String city, + @RequestParam("street") String street, + @RequestParam("number") String number, + @RequestParam("pendingid") String pendingId) { + log.info("Search with '{}', '{}', '{}'", city, street, number); + // TODO validate pendingId +// try { +// pendingReqGeneration.validateAndGetPendingRequestId(pendingId); +// } catch (PendingReqIdValidationException e) { +// log.warn("Search with pendingId '{}' is not valid", pendingId); +// return ResponseEntity.badRequest().build(); +// } + AdresssucheOutput output = new AdresssucheOutput("Where the streets have no name", "No Name", "42"); + return ResponseEntity.ok(output); + } + + public static class AdresssucheOutput { + private final String city; + private final String street; + private final String number; + + public AdresssucheOutput(String city, String street, String number) { + this.city = city; + this.street = street; + this.number = number; + } + + public String getCity() { + return city; + } + + public String getStreet() { + return street; + } + + public String getNumber() { + return number; + } + + @Override + public String toString() { + return "AdresssucheOutput{" + + "city='" + city + '\'' + + ", street='" + street + '\'' + + ", number='" + number + '\'' + + '}'; + } + } + +} -- cgit v1.2.3 From e5934d538aabcfc1f3b92472753de729d6ce1cce Mon Sep 17 00:00:00 2001 From: Christian Kollmann Date: Thu, 2 Dec 2021 09:06:55 +0100 Subject: Search with user provided input in ZMR for addresses --- .../controller/AdresssucheController.java | 84 +++++++++++++++++++--- 1 file changed, 73 insertions(+), 11 deletions(-) (limited to 'connector/src/main/java/at/asitplus') diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java index 35f56012..8b25a7bd 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java @@ -25,13 +25,19 @@ package at.asitplus.eidas.specific.connector.controller; import at.asitplus.eidas.specific.connector.MsEidasNodeConstants; import at.asitplus.eidas.specific.connector.gui.StaticGuiBuilderConfiguration; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.zmr.ZmrAddressSoapClient; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasSAuthenticationException; +import at.gv.bmi.namespace.zmr_su.zrm._20040201_.address.Adressdaten; +import at.gv.e_government.reference.namespace.persondata.de._20040201.PostAdresseTyp; +import at.gv.e_government.reference.namespace.persondata.de._20040201.ZustelladresseTyp; import at.gv.egiz.eaaf.core.api.gui.IGuiBuilderConfiguration; import at.gv.egiz.eaaf.core.api.gui.ISpringMvcGuiFormBuilder; import at.gv.egiz.eaaf.core.api.idp.IConfiguration; import at.gv.egiz.eaaf.core.api.utils.IPendingRequestIdGenerationStrategy; import at.gv.egiz.eaaf.core.exceptions.GuiBuildException; -import at.gv.egiz.eaaf.core.exceptions.PendingReqIdValidationException; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.ResourceLoader; import org.springframework.http.ResponseEntity; @@ -61,6 +67,9 @@ public class AdresssucheController { @Autowired private ResourceLoader resourceLoader; + @Autowired + private ZmrAddressSoapClient client; + @Autowired private IPendingRequestIdGenerationStrategy pendingReqGeneration; @@ -79,11 +88,12 @@ public class AdresssucheController { } @RequestMapping(value = {"/residency/search"}, method = {RequestMethod.POST}) - public ResponseEntity search(@RequestParam("city") String city, + public ResponseEntity search(@RequestParam("municipality") String municipality, + @RequestParam("village") String village, @RequestParam("street") String street, @RequestParam("number") String number, @RequestParam("pendingid") String pendingId) { - log.info("Search with '{}', '{}', '{}'", city, street, number); + log.info("Search with '{}', '{}', '{}'", municipality, street, number); // TODO validate pendingId // try { // pendingReqGeneration.validateAndGetPendingRequestId(pendingId); @@ -91,23 +101,74 @@ public class AdresssucheController { // log.warn("Search with pendingId '{}' is not valid", pendingId); // return ResponseEntity.badRequest().build(); // } - AdresssucheOutput output = new AdresssucheOutput("Where the streets have no name", "No Name", "42"); - return ResponseEntity.ok(output); + try { + Adressdaten searchInput = buildSearchInput(municipality, village, street, number); + ZmrAddressSoapClient.AddressInfo searchOutput = client.searchAddress(searchInput); + AdresssucheOutput output = buildResponse(searchOutput); + return ResponseEntity.ok(output); + } catch (EidasSAuthenticationException e) { + log.warn("Search failed", e); + return ResponseEntity.badRequest().build(); + } + } + + private AdresssucheOutput buildResponse(ZmrAddressSoapClient.AddressInfo searchOutput) { + if (searchOutput.getPersonResult().isEmpty()) { + log.warn("No result from ZMR"); + return new AdresssucheOutput(null, null, null, null); + } + Adressdaten adressdaten = searchOutput.getPersonResult().iterator().next(); + String municipality = adressdaten.getPostAdresse().getGemeinde(); + String village = adressdaten.getPostAdresse().getOrtschaft(); + String street = adressdaten.getPostAdresse().getZustelladresse().getStrassenname(); + String number = adressdaten.getPostAdresse().getZustelladresse().getOrientierungsnummer(); + log.debug("Result from ZMR: '{}', '{}', '{}', '{}'", municipality, village, street, number); + return new AdresssucheOutput(municipality, village, street, number); + } + + @NotNull + private Adressdaten buildSearchInput(String municipality, String village, String street, String number) { + PostAdresseTyp postAdresse = new PostAdresseTyp(); + if (StringUtils.isNotBlank(municipality)) { + postAdresse.setGemeinde(municipality); + } + if (StringUtils.isNotBlank(village)) { + postAdresse.setOrtschaft(village); + } + if (StringUtils.isNotBlank(street) || StringUtils.isNotBlank(number)) { + ZustelladresseTyp zustelladresse = new ZustelladresseTyp(); + if (StringUtils.isNotBlank(street)) { + zustelladresse.setStrassenname(street); + } + if (StringUtils.isNotBlank(number)) { + zustelladresse.setOrientierungsnummer(number); + } + postAdresse.setZustelladresse(zustelladresse); + } + Adressdaten searchInput = new Adressdaten(); + searchInput.setPostAdresse(postAdresse); + return searchInput; } public static class AdresssucheOutput { - private final String city; + private final String municipality; + private final String village; private final String street; private final String number; - public AdresssucheOutput(String city, String street, String number) { - this.city = city; + public AdresssucheOutput(String municipality, String village, String street, String number) { + this.municipality = municipality; + this.village = village; this.street = street; this.number = number; } - public String getCity() { - return city; + public String getMunicipality() { + return municipality; + } + + public String getVillage() { + return village; } public String getStreet() { @@ -121,7 +182,8 @@ public class AdresssucheController { @Override public String toString() { return "AdresssucheOutput{" + - "city='" + city + '\'' + + "municipality='" + municipality + '\'' + + ", village='" + village + '\'' + ", street='" + street + '\'' + ", number='" + number + '\'' + '}'; -- cgit v1.2.3 From 6fff1b53525348d531c96b45c920a8ce72288f60 Mon Sep 17 00:00:00 2001 From: Christian Kollmann Date: Thu, 2 Dec 2021 15:03:09 +0100 Subject: Display all results to user after residency search --- .../controller/AdresssucheController.java | 82 +++++++++++----------- 1 file changed, 40 insertions(+), 42 deletions(-) (limited to 'connector/src/main/java/at/asitplus') diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java index 8b25a7bd..c35aa8b9 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java @@ -35,8 +35,11 @@ import at.gv.egiz.eaaf.core.api.gui.ISpringMvcGuiFormBuilder; import at.gv.egiz.eaaf.core.api.idp.IConfiguration; import at.gv.egiz.eaaf.core.api.utils.IPendingRequestIdGenerationStrategy; import at.gv.egiz.eaaf.core.exceptions.GuiBuildException; +import lombok.AllArgsConstructor; +import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.builder.CompareToBuilder; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.ResourceLoader; @@ -48,6 +51,8 @@ import org.springframework.web.bind.annotation.RequestParam; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.util.*; +import java.util.stream.Collectors; /** * Default process-engine signaling controller. @@ -88,7 +93,7 @@ public class AdresssucheController { } @RequestMapping(value = {"/residency/search"}, method = {RequestMethod.POST}) - public ResponseEntity search(@RequestParam("municipality") String municipality, + public ResponseEntity search(@RequestParam("municipality") String municipality, @RequestParam("village") String village, @RequestParam("street") String street, @RequestParam("number") String number, @@ -104,7 +109,7 @@ public class AdresssucheController { try { Adressdaten searchInput = buildSearchInput(municipality, village, street, number); ZmrAddressSoapClient.AddressInfo searchOutput = client.searchAddress(searchInput); - AdresssucheOutput output = buildResponse(searchOutput); + AdresssucheResult output = buildResponse(searchOutput); return ResponseEntity.ok(output); } catch (EidasSAuthenticationException e) { log.warn("Search failed", e); @@ -112,18 +117,22 @@ public class AdresssucheController { } } - private AdresssucheOutput buildResponse(ZmrAddressSoapClient.AddressInfo searchOutput) { + private AdresssucheResult buildResponse(ZmrAddressSoapClient.AddressInfo searchOutput) { if (searchOutput.getPersonResult().isEmpty()) { log.warn("No result from ZMR"); - return new AdresssucheOutput(null, null, null, null); + return new AdresssucheResult(Collections.emptyList(), 0, false, null); } - Adressdaten adressdaten = searchOutput.getPersonResult().iterator().next(); - String municipality = adressdaten.getPostAdresse().getGemeinde(); - String village = adressdaten.getPostAdresse().getOrtschaft(); - String street = adressdaten.getPostAdresse().getZustelladresse().getStrassenname(); - String number = adressdaten.getPostAdresse().getZustelladresse().getOrientierungsnummer(); - log.debug("Result from ZMR: '{}', '{}', '{}', '{}'", municipality, village, street, number); - return new AdresssucheOutput(municipality, village, street, number); + boolean moreResults = false; + new HashSet<>(); + log.info("Result level is {}", searchOutput.getLevel()); + Set result = searchOutput.getPersonResult().stream() + .map(Adressdaten::getPostAdresse) + .map(it -> new AdresssucheOutput(it.getGemeinde(), it.getOrtschaft(), + it.getZustelladresse().getStrassenname(), it.getZustelladresse().getOrientierungsnummer())) + .collect(Collectors.toSet()); + // TODO Add configuration option for the limit of 30 + List sorted = result.stream().sorted().limit(30).collect(Collectors.toList()); + return new AdresssucheResult(sorted, result.size(), moreResults, searchOutput.getLevel().name()); } @NotNull @@ -150,43 +159,32 @@ public class AdresssucheController { return searchInput; } - public static class AdresssucheOutput { + @Data + @AllArgsConstructor + public static class AdresssucheResult { + private final Collection results; + private final int resultCount; + private final boolean moreResults; + private final String detailLevel; + + } + + @Data + @AllArgsConstructor + public static class AdresssucheOutput implements Comparable { private final String municipality; private final String village; private final String street; private final String number; - public AdresssucheOutput(String municipality, String village, String street, String number) { - this.municipality = municipality; - this.village = village; - this.street = street; - this.number = number; - } - - public String getMunicipality() { - return municipality; - } - - public String getVillage() { - return village; - } - - public String getStreet() { - return street; - } - - public String getNumber() { - return number; - } - @Override - public String toString() { - return "AdresssucheOutput{" + - "municipality='" + municipality + '\'' + - ", village='" + village + '\'' + - ", street='" + street + '\'' + - ", number='" + number + '\'' + - '}'; + public int compareTo(@NotNull AdresssucheOutput o) { + return new CompareToBuilder() + .append(this.municipality, o.municipality) + .append(this.village, o.village) + .append(this.street, o.street) + .append(this.number, o.number) + .toComparison(); } } -- cgit v1.2.3 From ac56869c2a981e40d6cf4637fb8fd46c06207c9d Mon Sep 17 00:00:00 2001 From: Christian Kollmann Date: Thu, 2 Dec 2021 16:05:57 +0100 Subject: Add PLZ to search for adresses in ZMR --- .../controller/AdresssucheController.java | 69 ++++++++++++++-------- 1 file changed, 44 insertions(+), 25 deletions(-) (limited to 'connector/src/main/java/at/asitplus') diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java index c35aa8b9..f71917c3 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java @@ -30,11 +30,12 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasSAuthenti import at.gv.bmi.namespace.zmr_su.zrm._20040201_.address.Adressdaten; import at.gv.e_government.reference.namespace.persondata.de._20040201.PostAdresseTyp; import at.gv.e_government.reference.namespace.persondata.de._20040201.ZustelladresseTyp; -import at.gv.egiz.eaaf.core.api.gui.IGuiBuilderConfiguration; import at.gv.egiz.eaaf.core.api.gui.ISpringMvcGuiFormBuilder; import at.gv.egiz.eaaf.core.api.idp.IConfiguration; import at.gv.egiz.eaaf.core.api.utils.IPendingRequestIdGenerationStrategy; +import at.gv.egiz.eaaf.core.exceptions.EaafException; import at.gv.egiz.eaaf.core.exceptions.GuiBuildException; +import at.gv.egiz.eaaf.core.exceptions.PendingReqIdValidationException; import lombok.AllArgsConstructor; import lombok.Data; import lombok.extern.slf4j.Slf4j; @@ -51,7 +52,10 @@ import org.springframework.web.bind.annotation.RequestParam; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Set; import java.util.stream.Collectors; /** @@ -78,9 +82,13 @@ public class AdresssucheController { @Autowired private IPendingRequestIdGenerationStrategy pendingReqGeneration; + /** + * Show the "residency.html" directly. + * TODO Remove this after testing. + */ @RequestMapping(value = {"/test"}, method = {RequestMethod.GET}) - public void test(HttpServletRequest request, HttpServletResponse response) throws GuiBuildException { - final IGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( + public void test(HttpServletRequest request, HttpServletResponse response) throws GuiBuildException, EaafException { + final StaticGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( basicConfig, "http://localhost:8080/ms_connector/", basicConfig.getBasicConfiguration(//TODO @@ -88,26 +96,34 @@ public class AdresssucheController { MsEidasNodeConstants.TEMPLATE_HTML_RESIDENCY), MsEidasNodeConstants.ENDPOINT_RESIDENCY_INPUT, resourceLoader); - // TODO Set the pendingId somehow + config.putCustomParameter(null, "pendingid", pendingReqGeneration.generateExternalPendingRequestId()); guiBuilder.build(request, response, config, "Query Austrian residency"); } + /** + * Performs search for addresses in ZMR. + */ @RequestMapping(value = {"/residency/search"}, method = {RequestMethod.POST}) - public ResponseEntity search(@RequestParam("municipality") String municipality, + public ResponseEntity search(@RequestParam("postleitzahl") String postleitzahl, + @RequestParam("municipality") String municipality, @RequestParam("village") String village, @RequestParam("street") String street, @RequestParam("number") String number, @RequestParam("pendingid") String pendingId) { - log.info("Search with '{}', '{}', '{}'", municipality, street, number); - // TODO validate pendingId -// try { -// pendingReqGeneration.validateAndGetPendingRequestId(pendingId); -// } catch (PendingReqIdValidationException e) { -// log.warn("Search with pendingId '{}' is not valid", pendingId); -// return ResponseEntity.badRequest().build(); -// } + log.info("Search with '{}', '{}', '{}', '{}', '{}'", + postleitzahl.replaceAll("[\r\n]", ""), + municipality.replaceAll("[\r\n]", ""), + village.replaceAll("[\r\n]", ""), + street.replaceAll("[\r\n]", ""), + number.replaceAll("[\r\n]", "")); try { - Adressdaten searchInput = buildSearchInput(municipality, village, street, number); + pendingReqGeneration.validateAndGetPendingRequestId(pendingId); + } catch (PendingReqIdValidationException e) { + log.warn("Search with pendingId '{}' is not valid", pendingId.replaceAll("[\r\n]", "")); + return ResponseEntity.badRequest().build(); + } + try { + Adressdaten searchInput = buildSearchInput(postleitzahl, municipality, village, street, number); ZmrAddressSoapClient.AddressInfo searchOutput = client.searchAddress(searchInput); AdresssucheResult output = buildResponse(searchOutput); return ResponseEntity.ok(output); @@ -120,24 +136,28 @@ public class AdresssucheController { private AdresssucheResult buildResponse(ZmrAddressSoapClient.AddressInfo searchOutput) { if (searchOutput.getPersonResult().isEmpty()) { log.warn("No result from ZMR"); - return new AdresssucheResult(Collections.emptyList(), 0, false, null); + return new AdresssucheResult(Collections.emptyList(), 0); } - boolean moreResults = false; - new HashSet<>(); log.info("Result level is {}", searchOutput.getLevel()); Set result = searchOutput.getPersonResult().stream() .map(Adressdaten::getPostAdresse) - .map(it -> new AdresssucheOutput(it.getGemeinde(), it.getOrtschaft(), + .map(it -> new AdresssucheOutput(it.getPostleitzahl(), it.getGemeinde(), it.getOrtschaft(), it.getZustelladresse().getStrassenname(), it.getZustelladresse().getOrientierungsnummer())) .collect(Collectors.toSet()); // TODO Add configuration option for the limit of 30 List sorted = result.stream().sorted().limit(30).collect(Collectors.toList()); - return new AdresssucheResult(sorted, result.size(), moreResults, searchOutput.getLevel().name()); + return new AdresssucheResult(sorted, result.size()); } - @NotNull - private Adressdaten buildSearchInput(String municipality, String village, String street, String number) { + private Adressdaten buildSearchInput(String postleitzahl, + String municipality, + String village, + String street, + String number) { PostAdresseTyp postAdresse = new PostAdresseTyp(); + if (StringUtils.isNotBlank(postleitzahl)) { + postAdresse.setPostleitzahl(postleitzahl); + } if (StringUtils.isNotBlank(municipality)) { postAdresse.setGemeinde(municipality); } @@ -164,14 +184,12 @@ public class AdresssucheController { public static class AdresssucheResult { private final Collection results; private final int resultCount; - private final boolean moreResults; - private final String detailLevel; - } @Data @AllArgsConstructor public static class AdresssucheOutput implements Comparable { + private final String postleitzahl; private final String municipality; private final String village; private final String street; @@ -180,6 +198,7 @@ public class AdresssucheController { @Override public int compareTo(@NotNull AdresssucheOutput o) { return new CompareToBuilder() + .append(this.postleitzahl, o.postleitzahl) .append(this.municipality, o.municipality) .append(this.village, o.village) .append(this.street, o.street) -- cgit v1.2.3 From 8d2aa68bc18c04c2b03cbdd01f008a89e4c8c1c6 Mon Sep 17 00:00:00 2001 From: Christian Kollmann Date: Tue, 7 Dec 2021 07:51:10 +0100 Subject: Unify HTML templates across test, main, basicConfig --- .../controller/AdresssucheController.java | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'connector/src/main/java/at/asitplus') diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java index f71917c3..b044e95e 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java @@ -100,6 +100,44 @@ public class AdresssucheController { guiBuilder.build(request, response, config, "Query Austrian residency"); } + /** + * Show the "other_login_method.html" directly. + * TODO Remove this after testing. + */ + @RequestMapping(value = {"/olm"}, method = {RequestMethod.GET}) + public void otherloginmethod(HttpServletRequest request, HttpServletResponse response) throws GuiBuildException, + EaafException { + final StaticGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( + basicConfig, + "http://localhost:8080/ms_connector/", + basicConfig.getBasicConfiguration(//TODO + MsEidasNodeConstants.PROP_CONFIG_WEBCONTENT_TEMPLATES_OTHER_LOGIN_METHOD_SELECTION, + MsEidasNodeConstants.TEMPLATE_HTML_OTHERLOGINMETHODS), + MsEidasNodeConstants.ENDPOINT_OTHER_LOGIN_METHOD_SELECTION, + resourceLoader); + config.putCustomParameter(null, "pendingid", pendingReqGeneration.generateExternalPendingRequestId()); + guiBuilder.build(request, response, config, "Other Login Method"); + } + + /** + * Show the "country_selection.html" directly. + * TODO Remove this after testing. + */ + @RequestMapping(value = {"/country"}, method = {RequestMethod.GET}) + public void countryselection(HttpServletRequest request, HttpServletResponse response) throws GuiBuildException, + EaafException { + final StaticGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( + basicConfig, + "http://localhost:8080/ms_connector/", + basicConfig.getBasicConfiguration(//TODO + MsEidasNodeConstants.PROP_CONFIG_WEBCONTENT_TEMPLATES_CCSELECTION, + MsEidasNodeConstants.TEMPLATE_HTML_COUNTRYSELECTION), + MsEidasNodeConstants.ENDPOINT_COUNTRYSELECTION, + resourceLoader); + config.putCustomParameter(null, "pendingid", pendingReqGeneration.generateExternalPendingRequestId()); + guiBuilder.build(request, response, config, "Country Selection"); + } + /** * Performs search for addresses in ZMR. */ -- cgit v1.2.3 From a2baf085fcd3a1940585beb3f4a8acb2e4e5a461 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Tue, 8 Feb 2022 11:40:01 +0100 Subject: refactor(matching): move AddresssucheController into eIDAS module to reuse data-model for tasks --- .../controller/AdresssucheController.java | 248 --------------------- 1 file changed, 248 deletions(-) delete mode 100644 connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java (limited to 'connector/src/main/java/at/asitplus') diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java deleted file mode 100644 index b044e95e..00000000 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/AdresssucheController.java +++ /dev/null @@ -1,248 +0,0 @@ -/* - * Copyright 2018 A-SIT Plus GmbH - * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ, - * A-SIT Plus GmbH, A-SIT, and Graz University of Technology. - * - * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "License"); - * You may not use this work except in compliance with the License. - * You may obtain a copy of the License at: - * https://joinup.ec.europa.eu/news/understanding-eupl-v12 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ - -package at.asitplus.eidas.specific.connector.controller; - -import at.asitplus.eidas.specific.connector.MsEidasNodeConstants; -import at.asitplus.eidas.specific.connector.gui.StaticGuiBuilderConfiguration; -import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.zmr.ZmrAddressSoapClient; -import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasSAuthenticationException; -import at.gv.bmi.namespace.zmr_su.zrm._20040201_.address.Adressdaten; -import at.gv.e_government.reference.namespace.persondata.de._20040201.PostAdresseTyp; -import at.gv.e_government.reference.namespace.persondata.de._20040201.ZustelladresseTyp; -import at.gv.egiz.eaaf.core.api.gui.ISpringMvcGuiFormBuilder; -import at.gv.egiz.eaaf.core.api.idp.IConfiguration; -import at.gv.egiz.eaaf.core.api.utils.IPendingRequestIdGenerationStrategy; -import at.gv.egiz.eaaf.core.exceptions.EaafException; -import at.gv.egiz.eaaf.core.exceptions.GuiBuildException; -import at.gv.egiz.eaaf.core.exceptions.PendingReqIdValidationException; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.builder.CompareToBuilder; -import org.jetbrains.annotations.NotNull; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.io.ResourceLoader; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * Default process-engine signaling controller. - * - * @author tlenz - */ -@Controller -@Slf4j -public class AdresssucheController { - - @Autowired - private ISpringMvcGuiFormBuilder guiBuilder; - - @Autowired - private IConfiguration basicConfig; - - @Autowired - private ResourceLoader resourceLoader; - - @Autowired - private ZmrAddressSoapClient client; - - @Autowired - private IPendingRequestIdGenerationStrategy pendingReqGeneration; - - /** - * Show the "residency.html" directly. - * TODO Remove this after testing. - */ - @RequestMapping(value = {"/test"}, method = {RequestMethod.GET}) - public void test(HttpServletRequest request, HttpServletResponse response) throws GuiBuildException, EaafException { - final StaticGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( - basicConfig, - "http://localhost:8080/ms_connector/", - basicConfig.getBasicConfiguration(//TODO - MsEidasNodeConstants.PROP_CONFIG_WEBCONTENT_TEMPLATES_RESIDENCY, - MsEidasNodeConstants.TEMPLATE_HTML_RESIDENCY), - MsEidasNodeConstants.ENDPOINT_RESIDENCY_INPUT, - resourceLoader); - config.putCustomParameter(null, "pendingid", pendingReqGeneration.generateExternalPendingRequestId()); - guiBuilder.build(request, response, config, "Query Austrian residency"); - } - - /** - * Show the "other_login_method.html" directly. - * TODO Remove this after testing. - */ - @RequestMapping(value = {"/olm"}, method = {RequestMethod.GET}) - public void otherloginmethod(HttpServletRequest request, HttpServletResponse response) throws GuiBuildException, - EaafException { - final StaticGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( - basicConfig, - "http://localhost:8080/ms_connector/", - basicConfig.getBasicConfiguration(//TODO - MsEidasNodeConstants.PROP_CONFIG_WEBCONTENT_TEMPLATES_OTHER_LOGIN_METHOD_SELECTION, - MsEidasNodeConstants.TEMPLATE_HTML_OTHERLOGINMETHODS), - MsEidasNodeConstants.ENDPOINT_OTHER_LOGIN_METHOD_SELECTION, - resourceLoader); - config.putCustomParameter(null, "pendingid", pendingReqGeneration.generateExternalPendingRequestId()); - guiBuilder.build(request, response, config, "Other Login Method"); - } - - /** - * Show the "country_selection.html" directly. - * TODO Remove this after testing. - */ - @RequestMapping(value = {"/country"}, method = {RequestMethod.GET}) - public void countryselection(HttpServletRequest request, HttpServletResponse response) throws GuiBuildException, - EaafException { - final StaticGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( - basicConfig, - "http://localhost:8080/ms_connector/", - basicConfig.getBasicConfiguration(//TODO - MsEidasNodeConstants.PROP_CONFIG_WEBCONTENT_TEMPLATES_CCSELECTION, - MsEidasNodeConstants.TEMPLATE_HTML_COUNTRYSELECTION), - MsEidasNodeConstants.ENDPOINT_COUNTRYSELECTION, - resourceLoader); - config.putCustomParameter(null, "pendingid", pendingReqGeneration.generateExternalPendingRequestId()); - guiBuilder.build(request, response, config, "Country Selection"); - } - - /** - * Performs search for addresses in ZMR. - */ - @RequestMapping(value = {"/residency/search"}, method = {RequestMethod.POST}) - public ResponseEntity search(@RequestParam("postleitzahl") String postleitzahl, - @RequestParam("municipality") String municipality, - @RequestParam("village") String village, - @RequestParam("street") String street, - @RequestParam("number") String number, - @RequestParam("pendingid") String pendingId) { - log.info("Search with '{}', '{}', '{}', '{}', '{}'", - postleitzahl.replaceAll("[\r\n]", ""), - municipality.replaceAll("[\r\n]", ""), - village.replaceAll("[\r\n]", ""), - street.replaceAll("[\r\n]", ""), - number.replaceAll("[\r\n]", "")); - try { - pendingReqGeneration.validateAndGetPendingRequestId(pendingId); - } catch (PendingReqIdValidationException e) { - log.warn("Search with pendingId '{}' is not valid", pendingId.replaceAll("[\r\n]", "")); - return ResponseEntity.badRequest().build(); - } - try { - Adressdaten searchInput = buildSearchInput(postleitzahl, municipality, village, street, number); - ZmrAddressSoapClient.AddressInfo searchOutput = client.searchAddress(searchInput); - AdresssucheResult output = buildResponse(searchOutput); - return ResponseEntity.ok(output); - } catch (EidasSAuthenticationException e) { - log.warn("Search failed", e); - return ResponseEntity.badRequest().build(); - } - } - - private AdresssucheResult buildResponse(ZmrAddressSoapClient.AddressInfo searchOutput) { - if (searchOutput.getPersonResult().isEmpty()) { - log.warn("No result from ZMR"); - return new AdresssucheResult(Collections.emptyList(), 0); - } - log.info("Result level is {}", searchOutput.getLevel()); - Set result = searchOutput.getPersonResult().stream() - .map(Adressdaten::getPostAdresse) - .map(it -> new AdresssucheOutput(it.getPostleitzahl(), it.getGemeinde(), it.getOrtschaft(), - it.getZustelladresse().getStrassenname(), it.getZustelladresse().getOrientierungsnummer())) - .collect(Collectors.toSet()); - // TODO Add configuration option for the limit of 30 - List sorted = result.stream().sorted().limit(30).collect(Collectors.toList()); - return new AdresssucheResult(sorted, result.size()); - } - - private Adressdaten buildSearchInput(String postleitzahl, - String municipality, - String village, - String street, - String number) { - PostAdresseTyp postAdresse = new PostAdresseTyp(); - if (StringUtils.isNotBlank(postleitzahl)) { - postAdresse.setPostleitzahl(postleitzahl); - } - if (StringUtils.isNotBlank(municipality)) { - postAdresse.setGemeinde(municipality); - } - if (StringUtils.isNotBlank(village)) { - postAdresse.setOrtschaft(village); - } - if (StringUtils.isNotBlank(street) || StringUtils.isNotBlank(number)) { - ZustelladresseTyp zustelladresse = new ZustelladresseTyp(); - if (StringUtils.isNotBlank(street)) { - zustelladresse.setStrassenname(street); - } - if (StringUtils.isNotBlank(number)) { - zustelladresse.setOrientierungsnummer(number); - } - postAdresse.setZustelladresse(zustelladresse); - } - Adressdaten searchInput = new Adressdaten(); - searchInput.setPostAdresse(postAdresse); - return searchInput; - } - - @Data - @AllArgsConstructor - public static class AdresssucheResult { - private final Collection results; - private final int resultCount; - } - - @Data - @AllArgsConstructor - public static class AdresssucheOutput implements Comparable { - private final String postleitzahl; - private final String municipality; - private final String village; - private final String street; - private final String number; - - @Override - public int compareTo(@NotNull AdresssucheOutput o) { - return new CompareToBuilder() - .append(this.postleitzahl, o.postleitzahl) - .append(this.municipality, o.municipality) - .append(this.village, o.village) - .append(this.street, o.street) - .append(this.number, o.number) - .toComparison(); - } - } - -} -- cgit v1.2.3 From 32988b1df31a0ed1a31275371b18201a10db88d7 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 10 Mar 2022 13:23:58 +0100 Subject: chore(core): add Spring based message source to MS-Connector --- .../connector/config/MsConnectorMessageSource.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 connector/src/main/java/at/asitplus/eidas/specific/connector/config/MsConnectorMessageSource.java (limited to 'connector/src/main/java/at/asitplus') diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/config/MsConnectorMessageSource.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/config/MsConnectorMessageSource.java new file mode 100644 index 00000000..59df6375 --- /dev/null +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/config/MsConnectorMessageSource.java @@ -0,0 +1,21 @@ +package at.asitplus.eidas.specific.connector.config; + +import java.util.Arrays; +import java.util.List; + +import at.gv.egiz.eaaf.core.api.logging.IMessageSourceLocation; + +/** + * Inject eIDAS Connector specific messages into Spring based message-source. + * + * @author tlenz + * + */ +public class MsConnectorMessageSource implements IMessageSourceLocation { + + @Override + public List getMessageSourceLocation() { + return Arrays.asList("classpath:/properties/messages"); + } + +} -- cgit v1.2.3 From 5ab8c1e33a1e4c4e4b782eb575f6ad0add4dfeec Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 10 Mar 2022 14:34:39 +0100 Subject: fix(matching): add missing endpoint for search-address requests --- .../specific/connector/controller/ProcessEngineSignalController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'connector/src/main/java/at/asitplus') diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/ProcessEngineSignalController.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/ProcessEngineSignalController.java index a7695d1b..f360185b 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/ProcessEngineSignalController.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/ProcessEngineSignalController.java @@ -47,7 +47,8 @@ public class ProcessEngineSignalController extends AbstractProcessEngineSignalCo @RequestMapping(value = { MsEidasNodeConstants.ENDPOINT_COUNTRYSELECTION, - MsEidasNodeConstants.ENDPOINT_OTHER_LOGIN_METHOD_SELECTION + MsEidasNodeConstants.ENDPOINT_OTHER_LOGIN_METHOD_SELECTION, + MsEidasNodeConstants.ENDPOINT_RESIDENCY_INPUT }, method = { RequestMethod.POST, RequestMethod.GET }) public void performGenericAuthenticationProcess(HttpServletRequest req, HttpServletResponse resp) -- cgit v1.2.3 From de5ce9ef743335a14080441194cb8bde1f851167 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 31 Mar 2022 14:38:17 +0200 Subject: refactor(core): remove deprecated operations on openSAML4 API --- .../eidas/specific/connector/config/PvpEndPointConfiguration.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'connector/src/main/java/at/asitplus') diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/config/PvpEndPointConfiguration.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/config/PvpEndPointConfiguration.java index c62cbeef..81c37bd0 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/config/PvpEndPointConfiguration.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/config/PvpEndPointConfiguration.java @@ -89,11 +89,11 @@ public class PvpEndPointConfiguration implements IPvp2BasicConfiguration { final SurName surname = Saml2Utils.createSamlObject(SurName.class); final EmailAddress emailAddress = Saml2Utils.createSamlObject(EmailAddress.class); - givenName.setName(getAndVerifyFromConfiguration( + givenName.setValue(getAndVerifyFromConfiguration( MsEidasNodeConstants.CONFIG_PROPS_METADATA_CONTACT_GIVENNAME)); - surname.setName(getAndVerifyFromConfiguration( + surname.setValue(getAndVerifyFromConfiguration( MsEidasNodeConstants.CONFIG_PROPS_METADATA_CONTACT_SURNAME)); - emailAddress.setAddress(getAndVerifyFromConfiguration( + emailAddress.setURI(getAndVerifyFromConfiguration( MsEidasNodeConstants.CONFIG_PROPS_METADATA_CONTACT_EMAIL)); contactPerson.setType(ContactPersonTypeEnumeration.TECHNICAL); @@ -121,7 +121,7 @@ public class PvpEndPointConfiguration implements IPvp2BasicConfiguration { MsEidasNodeConstants.CONFIG_PROPS_METADATA_ORGANISATION_FRIENDLYNAME)); orgUrl.setXMLLang(DEFAULT_XML_LANG); - orgUrl.setValue(getAndVerifyFromConfiguration( + orgUrl.setURI(getAndVerifyFromConfiguration( MsEidasNodeConstants.CONFIG_PROPS_METADATA_ORGANISATION_URL)); -- cgit v1.2.3 From d9a402c18755d47ad17283c5c52fc2311df56e85 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Mon, 2 May 2022 12:24:13 +0200 Subject: fix(gui): fix possible errors on language selection by GUI operation --- .../processes/tasks/GenerateCountrySelectionFrameTask.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'connector/src/main/java/at/asitplus') diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/processes/tasks/GenerateCountrySelectionFrameTask.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/processes/tasks/GenerateCountrySelectionFrameTask.java index e87979fb..5cc15814 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/processes/tasks/GenerateCountrySelectionFrameTask.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/processes/tasks/GenerateCountrySelectionFrameTask.java @@ -38,7 +38,7 @@ import at.gv.egiz.eaaf.core.api.idp.IConfiguration; import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; import at.gv.egiz.eaaf.core.exceptions.EaafException; import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException; -import at.gv.egiz.eaaf.core.impl.idp.auth.modules.AbstractAuthServletTask; +import at.gv.egiz.eaaf.core.impl.idp.controller.tasks.AbstractLocaleAuthServletTask; /** * Create country-selection page. @@ -47,7 +47,7 @@ import at.gv.egiz.eaaf.core.impl.idp.auth.modules.AbstractAuthServletTask; * */ @Component("GenerateCountrySelectionFrameTask") -public class GenerateCountrySelectionFrameTask extends AbstractAuthServletTask { +public class GenerateCountrySelectionFrameTask extends AbstractLocaleAuthServletTask { @Autowired ISpringMvcGuiFormBuilder guiBuilder; @@ -56,7 +56,7 @@ public class GenerateCountrySelectionFrameTask extends AbstractAuthServletTask { @Override - public void execute(ExecutionContext executionContext, HttpServletRequest request, + public void executeWithLocale(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) throws TaskExecutionException { try { -- cgit v1.2.3 From 69aa81016fe20e901a3be02bb6772c9185c0b9ef Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Mon, 2 May 2022 17:16:15 +0200 Subject: chore(matching): re-oreder process steps in GUI releated matching --- .../connector/processes/tasks/GenerateCountrySelectionFrameTask.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'connector/src/main/java/at/asitplus') diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/processes/tasks/GenerateCountrySelectionFrameTask.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/processes/tasks/GenerateCountrySelectionFrameTask.java index 5cc15814..57a4c19a 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/processes/tasks/GenerateCountrySelectionFrameTask.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/processes/tasks/GenerateCountrySelectionFrameTask.java @@ -57,8 +57,7 @@ public class GenerateCountrySelectionFrameTask extends AbstractLocaleAuthServlet @Override public void executeWithLocale(ExecutionContext executionContext, HttpServletRequest request, - HttpServletResponse response) - throws TaskExecutionException { + HttpServletResponse response) throws TaskExecutionException { try { revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.STARTING_COUNTRY_SELECTION); -- cgit v1.2.3