aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules
diff options
context:
space:
mode:
authorChristian Kollmann <christian.kollmann@a-sit.at>2021-12-02 09:06:55 +0100
committerChristian Kollmann <christian.kollmann@a-sit.at>2021-12-02 16:13:48 +0100
commite5934d538aabcfc1f3b92472753de729d6ce1cce (patch)
treee806c33042b2762b67265515de2d6f1f09152fad /eidas_modules
parent401cd39689d73f1cc865bb3c7cfca40a3f5ac625 (diff)
downloadNational_eIDAS_Gateway-e5934d538aabcfc1f3b92472753de729d6ce1cce.tar.gz
National_eIDAS_Gateway-e5934d538aabcfc1f3b92472753de729d6ce1cce.tar.bz2
National_eIDAS_Gateway-e5934d538aabcfc1f3b92472753de729d6ce1cce.zip
Search with user provided input in ZMR for addresses
Diffstat (limited to 'eidas_modules')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrAddressSoapClient.java110
1 files changed, 56 insertions, 54 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrAddressSoapClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrAddressSoapClient.java
index d869ca37..5fb839af 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrAddressSoapClient.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrAddressSoapClient.java
@@ -39,18 +39,18 @@ import lombok.extern.slf4j.Slf4j;
/**
* ZMR SOAP client for search-address operations.
- *
+ *
* @author tlenz
*
*/
@Slf4j
public class ZmrAddressSoapClient extends AbstractSoapClient {
-
+
private static final String CLIENT_DEFAULT = "ZMR-AddressSearch Client";
private static final String CLIENT_INFO = "eIDAS MS-Connector v{0}";
-
+
private static final String LOGMSG_ZMR_SOAP_ERROR =
- "ZMR anwser for transaction: {0} with code: {1} and message: {2}";
+ "ZMR anwser for transaction: {0} with code: {1} and message: {2}";
private static final String LOGMSG_ZMR_ERROR =
"Receive an error from ZMR during '{}' operation with msg: {}";
private static final String LOGMSG_ZMR_RESP_PROCESS =
@@ -58,37 +58,37 @@ public class ZmrAddressSoapClient extends AbstractSoapClient {
private static final String ERROR_MATCHING_07 = "module.eidasauth.matching.07";
private static final String ERROR_MATCHING_99 = "module.eidasauth.matching.99";
-
+
private static final String PROCESS_GENERAL = "GP_Abfragen";
private static final String PROCESS_TASK_ADDRESS_WIZZARD = "ZMR_VO_Adresssuche_im_GWR__6";
-
+
private static final String PROCESS_TASK_RESPONSE_LEVEL_CITY = "Ortschaft";
private static final String PROCESS_TASK_RESPONSE_LEVEL_STREET = "Strassenname";
private static final String PROCESS_TASK_RESPONSE_LEVEL_NUMBER = "Orientierungsnummer";
-
-
+
+
private static final String PROCESS_ADDRESS_WIZZARD = "PROCESS_SEARCH_WITH_ADDRESS_WIZZARD";
-
+
private static final String SEARCH_TYPE = "ADRESSSUCHE";
-
-
- @Autowired VersionHolder versionHolder;
+
+
+ @Autowired VersionHolder versionHolder;
private ServicePort zmrClient;
-
+
@Getter
@AllArgsConstructor
- public static class AddressInfo {
+ public static class AddressInfo {
private final BigInteger processId;
private final List<Adressdaten> personResult;
private final DetailLevel level;
-
+
}
-
+
public enum DetailLevel { CITY, STREET, NUMBER, UNKNOWN }
-
+
/**
- * Get address information based on ZMR data.
- *
+ * Get address information based on ZMR data.
+ *
* @param addressInfo Search parameters
* @return Address data
* @throws EidasSAuthenticationException In case of an error
@@ -96,12 +96,12 @@ public class ZmrAddressSoapClient extends AbstractSoapClient {
public AddressInfo searchAddress(@NonNull Adressdaten addressInfo)
throws EidasSAuthenticationException {
return searchAddress(addressInfo, null);
-
+
}
-
+
/**
- * Get address information based on ZMR data.
- *
+ * Get address information based on ZMR data.
+ *
* @param addressInfo Search parameters
* @param prozessInstanzId processId in case of associated requests
* @return Address data
@@ -111,33 +111,33 @@ public class ZmrAddressSoapClient extends AbstractSoapClient {
throws EidasSAuthenticationException {
try {
RequestType req = new RequestType();
-
+
// set generic informations
req.setClientInfo(generateClientInfos());
req.setWorkflowInfoClient(generateWorkFlowInfos(PROCESS_TASK_ADDRESS_WIZZARD, null));
-
+
AdresssucheRequest search = new AdresssucheRequest();
req.setAdresssucheRequest(search);
-
+
// set static search type
AdresssucheInfoType searchType = new AdresssucheInfoType();
searchType.setSuchart(SEARCH_TYPE);
search.setAdresssucheInfo(searchType);
-
+
// set search parameters
- search.setAdressdaten(addressInfo);
+ search.setAdressdaten(addressInfo);
// request ZMR address services
log.debug("Requesting ZMR for adddress search ....");
ResponseType resp = zmrClient.service(req, null);
- log.debug("Receice response for address search with #{} elements",
- resp.getAdresssucheResponse().getAdresssuchergebnis().getGefundeneSaetze());
-
+ log.debug("Receice response for address search with #{} elements",
+ resp.getAdresssucheResponse().getAdresssuchergebnis().getGefundeneSaetze());
+
return new AddressInfo(
- extractZmrProcessId(resp.getWorkflowInfoServer()),
- resp.getAdresssucheResponse().getAdresssuchergebnis().getAdressdaten(),
+ extractZmrProcessId(resp.getWorkflowInfoServer()),
+ resp.getAdresssucheResponse().getAdresssuchergebnis().getAdressdaten(),
extractAddressDetailLevel(resp.getAdresssucheResponse().getAdresssuchergebnis()));
-
+
} catch (final ServiceFault_Exception e) {
final String errorMsg = extractReasonFromError(e);
log.warn(LOGMSG_ZMR_ERROR, PROCESS_ADDRESS_WIZZARD, errorMsg);
@@ -154,7 +154,7 @@ public class ZmrAddressSoapClient extends AbstractSoapClient {
private void initialize() throws EaafConfigurationException {
// set-up the ZMR client
initializeTechnicalZmrClient();
-
+
}
private void initializeTechnicalZmrClient() throws EaafConfigurationException {
@@ -206,10 +206,10 @@ public class ZmrAddressSoapClient extends AbstractSoapClient {
Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_SSL_TRUSTSTORE_PASSWORD,
Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_SSL_TRUSTSTORE_NAME,
"ZMR-AddressSearch SSL Client-Authentication TrustStore"))
- .build());
-
+ .build());
+
}
-
+
@Nonnull
private ClientInfoType generateClientInfos() {
final ClientInfoType clientInfo = new ClientInfoType();
@@ -218,14 +218,14 @@ public class ZmrAddressSoapClient extends AbstractSoapClient {
// set client information
clientInfo.setClient(MessageFormat.format(CLIENT_INFO, versionHolder.getVersion()));
-
+
// set Behoerdennummer as organization identifier
clientOrganisation.setBehoerdenNr(basicConfig.getBasicConfiguration(
Constants.CONIG_PROPS_EIDAS_ZMRCLIENT_REQ_ORGANIZATION_NR));
-
+
return clientInfo;
}
-
+
@Nonnull
private static String extractReasonFromError(ServiceFault_Exception e) {
if (e.getFaultInfo() != null) {
@@ -239,10 +239,10 @@ public class ZmrAddressSoapClient extends AbstractSoapClient {
return e.getMessage();
}
- }
-
+ }
+
@Nonnull
- private static WorkflowInfoClient generateWorkFlowInfos(@Nonnull String subStepName,
+ private static WorkflowInfoClient generateWorkFlowInfos(@Nonnull String subStepName,
@Nullable BigInteger prozessInstanzId) {
final WorkflowInfoClient infos = new WorkflowInfoClient();
infos.setProzessName(PROCESS_GENERAL);
@@ -251,33 +251,35 @@ public class ZmrAddressSoapClient extends AbstractSoapClient {
//set processId that we received from ZMR before, if already available
if (prozessInstanzId != null) {
infos.setProzessInstanzID(prozessInstanzId);
-
+
}
-
+
return infos;
}
-
+
private static BigInteger extractZmrProcessId(WorkflowInfoServer workflowInfoServer) {
- return workflowInfoServer != null ? workflowInfoServer.getProzessInstanzID() : null;
+ return workflowInfoServer != null ? workflowInfoServer.getProzessInstanzID() : null;
}
-
+
private static DetailLevel extractAddressDetailLevel(AdresssuchergebnisType value) {
+ if (value.getDetailgrad() == null)
+ return DetailLevel.UNKNOWN;
switch (value.getDetailgrad()) {
case PROCESS_TASK_RESPONSE_LEVEL_CITY:
return DetailLevel.CITY;
-
+
case PROCESS_TASK_RESPONSE_LEVEL_STREET:
return DetailLevel.STREET;
-
+
case PROCESS_TASK_RESPONSE_LEVEL_NUMBER:
return DetailLevel.NUMBER;
-
+
default:
return DetailLevel.UNKNOWN;
-
+
}
}
-
+
}