From 802816a345059aa04c779cde246fd6cb2a2967fe Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Mon, 26 Jul 2021 10:33:21 +0200 Subject: update ZMR client WSDL to new version and refactor code to new API --- .../auth/eidas/v2/clients/zmr/ZmrSoapClient.java | 24 +++++++++---------- .../handler/DeSpecificDetailSearchProcessor.java | 2 +- .../eidas/v2/tasks/GenerateAuthnRequestTask.java | 27 ++++++++++++---------- 3 files changed, 28 insertions(+), 25 deletions(-) (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus') diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrSoapClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrSoapClient.java index c5f01392..29914e21 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrSoapClient.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/zmr/ZmrSoapClient.java @@ -125,9 +125,9 @@ public class ZmrSoapClient extends AbstractSoapClient implements IZmrClient { final PersonSuchenRequest searchPersonReq = new PersonSuchenRequest(); req.setPersonSuchenRequest(searchPersonReq); final EidasSuchdatenType eidasInfos = new EidasSuchdatenType(); - searchPersonReq.setEidasSuchdaten(eidasInfos); + searchPersonReq.getEidasSuchdaten().add(eidasInfos); eidasInfos.setEidasArt(Constants.eIDAS_ATTRURN_PERSONALIDENTIFIER); - eidasInfos.setEidasNummer(personPseudonym); + eidasInfos.setEidasWert(personPseudonym); // set work-flow client information req.setWorkflowInfoClient(generateWorkFlowInfos(PROCESS_SEARCH_PERSONAL_IDENTIFIER, null)); @@ -583,8 +583,8 @@ public class ZmrSoapClient extends AbstractSoapClient implements IZmrClient { String eidasAttrurnPersonalidentifier) { return person.getEidasIdentitaet().stream() .filter(el -> eidasAttrurnPersonalidentifier.equals(el.getEidasArt()) - && el.getStaatscode3().equals(citizenCountryCode)) - .map(el -> el.getDokumentNummer()) + && el.getStaatscode2().equals(citizenCountryCode)) + .map(el -> el.getEidasWert()) .collect(Collectors.toList()); } @@ -603,9 +603,9 @@ public class ZmrSoapClient extends AbstractSoapClient implements IZmrClient { String eidasAttrurnPersonalidentifier) { return person.getEidasIdentitaet().stream() .filter(el -> eidasAttrurnPersonalidentifier.equals(el.getEidasArt()) - && el.getStaatscode3().equals(citizenCountryCode)) + && el.getStaatscode2().equals(citizenCountryCode)) .findFirst() - .map(el -> el.getDokumentNummer()) + .map(el -> el.getEidasWert()) .orElse(null); } @@ -701,30 +701,30 @@ public class ZmrSoapClient extends AbstractSoapClient implements IZmrClient { // check if eIDAS attribute is already includes an eIDAS-Document boolean alreadyExist = zmrPersonToKitt.getEidasIdentitaet().stream() - .filter(el -> el.getDokumentNummer().equals(attrValue) + .filter(el -> el.getEidasWert().equals(attrValue) && el.getEidasArt().equals(attrName) - && el.getStaatscode3().equals(citizenCountryCode)) + && el.getStaatscode2().equals(citizenCountryCode)) .findAny() .isPresent(); if (!alreadyExist) { // check eIDAS documents already contains a document with this pair of country-code and attribute-name Optional oneDocWithNameExists = zmrPersonToKitt.getEidasIdentitaet().stream() - .filter(el -> el.getStaatscode3().equals(citizenCountryCode) + .filter(el -> el.getStaatscode2().equals(citizenCountryCode) && el.getEidasArt().equals(attrName)) .findAny(); if (!allowMoreThanOneEntry && oneDocWithNameExists.isPresent() - && !oneDocWithNameExists.get().getDokumentNummer().equals(attrValue)) { + && !oneDocWithNameExists.get().getEidasWert().equals(attrValue)) { log.warn("eIDAS document: {} already exists for country: {} but attribute-value does not match. " + "Skip update process because no multi-value allowed for this ... ", attrName, citizenCountryCode); } else { EidasIdentitaetAnlageType eidasDocToAdd = new EidasIdentitaetAnlageType(); - eidasDocToAdd.setStaatscode3(citizenCountryCode); + eidasDocToAdd.setStaatscode2(citizenCountryCode); eidasDocToAdd.setEidasArt(attrName); - eidasDocToAdd.setEidasNummer(attrValue); + eidasDocToAdd.setEidasWert(attrValue); log.info("Add eIDAS document: {} for country: {} to ZMR person", attrName, citizenCountryCode); result.add(eidasDocToAdd); diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java index 471cb115..b7fb25ea 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java @@ -63,7 +63,7 @@ public class DeSpecificDetailSearchProcessor implements CountrySpecificDetailSea //TODO: how we can search for more than one eIDAS attribute as a Set EidasSuchdatenType eidasInfos = new EidasSuchdatenType(); - req.setEidasSuchdaten(eidasInfos); + req.getEidasSuchdaten().add(eidasInfos); return req; diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAuthnRequestTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAuthnRequestTask.java index da9c8174..2b3fabd9 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAuthnRequestTask.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAuthnRequestTask.java @@ -23,6 +23,20 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks; +import java.io.IOException; +import java.util.UUID; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.NotNull; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Component; +import org.springframework.web.util.UriComponentsBuilder; + import at.asitplus.eidas.specific.connector.MsConnectorEventCodes; import at.asitplus.eidas.specific.connector.MsEidasNodeConstants; import at.asitplus.eidas.specific.connector.gui.StaticGuiBuilderConfiguration; @@ -48,18 +62,6 @@ import eu.eidas.specificcommunication.SpecificCommunicationDefinitionBeanNames; import eu.eidas.specificcommunication.exception.SpecificCommunicationException; import eu.eidas.specificcommunication.protocol.SpecificCommunicationService; 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.context.ApplicationContext; -import org.springframework.stereotype.Component; -import org.springframework.web.util.UriComponentsBuilder; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.UUID; /** @@ -249,6 +251,7 @@ public class GenerateAuthnRequestTask extends AbstractAuthServletTask { final UriComponentsBuilder redirectUrl = UriComponentsBuilder.fromHttpUrl(forwardUrl); redirectUrl.queryParam(EidasParameterKeys.TOKEN.toString(), tokenBase64); response.sendRedirect(redirectUrl.build().encode().toString()); + } private void sendPost(HttpServletRequest request, HttpServletResponse response, String tokenBase64, String forwardUrl) -- cgit v1.2.3