From 1a442f77692a0438cc9d43be563b0ca965ff6c2b Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Mon, 7 Feb 2022 11:17:42 +0100 Subject: refactor(szr): remove 'insertErnp' functionality from SZR client. After this, the person is directly added into ERnP by using ErnpRestClient --- .../auth/eidas/v2/clients/szr/SzrClient.java | 49 ---------------------- .../eidas/v2/tasks/CreateIdentityLinkTask.java | 29 ++----------- 2 files changed, 4 insertions(+), 74 deletions(-) (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main') diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/szr/SzrClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/szr/SzrClient.java index 397cbe46..bd1eb13e 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/szr/SzrClient.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/szr/SzrClient.java @@ -111,28 +111,6 @@ public class SzrClient extends AbstractSoapClient { final ObjectMapper mapper = new ObjectMapper(); - /** - * Get IdentityLink of a person. - * - * - * @param eidData minimum dataset of person - * @return IdentityLink - * @throws SzrCommunicationException In case of a SZR error - */ - public IdentityLinkType getIdentityLinkInRawMode(SimpleEidasData eidData) - throws SzrCommunicationException { - try { - final GetIdentityLinkEidas getIdl = new GetIdentityLinkEidas(); - getIdl.setPersonInfo(generateSzrRequest(eidData)); - - return getIdentityLinkGeneric(getIdl); - - } catch (final Exception e) { - log.warn("SZR communication FAILED. Reason: " + e.getMessage(), e); - throw new SzrCommunicationException("ernb.02", new Object[]{e.getMessage()}, e); - - } - } /** * Get IdentityLink of a person. @@ -206,33 +184,6 @@ public class SzrClient extends AbstractSoapClient { } return resp; } - - /** - * Request a encrypted baseId from SZR. - * - * Note: Previously, this method did create a new ERnP entry, if it did not exist. This is - * not the case any more. See {@link #createNewErnpEntry(SimpleEidasData)} for that functionality. - * - * @param eidData Minimum dataset of person - * @return encrypted baseId - * @throws SzrCommunicationException In case of a SZR error - */ - public String getEncryptedStammzahl(final SimpleEidasData eidData) - throws SzrCommunicationException { - final String resp; - try { - resp = this.szr.getStammzahlEncrypted(generateSzrRequest(eidData), false); - } catch (SZRException_Exception e) { - throw new SzrCommunicationException("ernb.02", new Object[]{e.getMessage()}, e); - } - - if (StringUtils.isEmpty(resp)) { - throw new SzrCommunicationException("ernb.01", new Object[]{"Stammzahl response empty"}); // TODO error handling - } - - return resp; - - } /** * Request a encrypted baseId from SZR. diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java index c95c275e..740e5292 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java @@ -86,9 +86,6 @@ import szrservices.IdentityLinkType; * - * TODO Take Constants#DATA_SIMPLE_EIDAS and Constants#DATA_RESULT_MATCHING_BPK - * TODO Only do VSZ Erstellung and eidasBind -- this is always the end of the whole process - * TODO Move Eintragung to separate Task, as it does not happen every time * @author tlenz */ @Slf4j @@ -192,16 +189,8 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { private void executeEidMode(SimpleEidasData eidData, MatchedPersonResult matchedPersonData) throws JsonProcessingException, EaafException, JoseException { // get encrypted baseId - String vsz; - if (matchedPersonData != null) { - log.debug("Requesting encrypted baseId by already matched person information ... "); - vsz = szrClient.getEncryptedStammzahl(matchedPersonData); - - } else { - log.debug("Requesting encrypted baseId by using eIDAS information directly ... "); - vsz = szrClient.createNewErnpEntry(eidData); - - } + log.debug("Requesting encrypted baseId by already matched person information ... "); + String vsz = szrClient.getEncryptedStammzahl(matchedPersonData); //write revision-Log entry and extended infos personal-identifier mapping revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.SZR_VSZ_RECEIVED); @@ -252,18 +241,8 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { private SzrResultHolder requestSzrForIdentityLink(SimpleEidasData eidData, MatchedPersonResult matchedPersonData) throws EaafException { //request IdentityLink from SZR - IdentityLinkType result; - - if (matchedPersonData != null) { - log.debug("Requesting encrypted baseId by already matched person information ... "); - result = szrClient.getIdentityLinkInRawMode(matchedPersonData); - - } else { - log.debug("Requesting encrypted baseId by using eIDAS information directly ... "); - result = szrClient.getIdentityLinkInRawMode(eidData); - - } - + log.debug("Requesting encrypted baseId by already matched person information ... "); + IdentityLinkType result = szrClient.getIdentityLinkInRawMode(matchedPersonData); final Element idlFromSzr = (Element) result.getAssertion(); final IIdentityLink identityLink = new SimpleIdentityLinkAssertionParser(idlFromSzr).parseIdentityLink(); -- cgit v1.2.3