diff options
| author | Thomas <> | 2022-03-03 15:06:28 +0100 | 
|---|---|---|
| committer | Thomas <> | 2022-03-03 15:06:28 +0100 | 
| commit | 7b2c31e14aa5f4823d970ec6ebd3e134a280f442 (patch) | |
| tree | 7638bd9f3b0e916e1db82b715b01d867190fe4ac /eidas_modules/authmodule-eIDAS-v2/src | |
| parent | 576344a004328d12aa293ff33fb7a392b825e0bd (diff) | |
| download | National_eIDAS_Gateway-7b2c31e14aa5f4823d970ec6ebd3e134a280f442.tar.gz National_eIDAS_Gateway-7b2c31e14aa5f4823d970ec6ebd3e134a280f442.tar.bz2 National_eIDAS_Gateway-7b2c31e14aa5f4823d970ec6ebd3e134a280f442.zip | |
fix(ernp): fix some problems in ERnP client that we found during tests
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src')
| -rw-r--r-- | eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java | 78 | 
1 files changed, 38 insertions, 40 deletions
| diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java index 66fec9dc..4c4e3d87 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java @@ -232,7 +232,7 @@ public class ErnpRestClient implements IErnpClient {            generic.getClientRequestTime(), generic.getClientRequestId(), personSuchen);        // parse ZMR response -      return processErnpResponse(resp, citizenCountryCode, false, countrySearchMsg); +      return processErnpResponse(resp, citizenCountryCode, true, countrySearchMsg);      } catch (RestClientException e) {        log.warn(LOGMSG_ERNP_ERROR, countrySearchMsg, e.getMessage()); @@ -289,31 +289,41 @@ public class ErnpRestClient implements IErnpClient {    @Override    public ErnpRegisterResult add(SimpleEidasData eidData) throws EidasSAuthenticationException { -    // build generic request metadata -    final GenericRequestParams generic = buildGenericRequestParameters("stepNew"); -     -    // build update request -    PersonAnlegen ernpReq = new PersonAnlegen(); -    ernpReq.setBegruendung(PROCESS_ADD_IDENITY); -         -    // inject person data -    Personendaten person = new Personendaten(); -    person.setFamilienname(eidData.getFamilyName()); -    person.setVorname(eidData.getGivenName()); -    person.setGeburtsdatum(buildErnpBirthday(eidData.getDateOfBirth()));        -    ernpReq.setPersonendaten(person); -     -    buildNewEidasDocumens(ernpReq, eidData); -            -    // request ERnP -    log.trace("Requesting ERnP for '{}' operation", PROCESS_ADD_IDENITY);        -    AnlegenResponse ernpResp = ernpClient.anlegen(generic.getClientBehkz(), generic.clientName, -        generic.getClientRequestTime(), generic.getClientRequestId(), ernpReq);         -    log.trace("Receive response from ERnP for '{}' operation", PROCESS_ADD_IDENITY); -     -    return  new ErnpRegisterResult(Arrays.asList( -        mapErnpResponseToRegisterResult(ernpResp.getPerson(), eidData.getCitizenCountryCode())));     +    try { +      // build generic request metadata +      final GenericRequestParams generic = buildGenericRequestParameters("stepNew"); +       +      // build update request +      PersonAnlegen ernpReq = new PersonAnlegen(); +      ernpReq.setBegruendung(PROCESS_ADD_IDENITY); +           +      // inject person data +      Personendaten person = new Personendaten(); +      person.setFamilienname(eidData.getFamilyName()); +      person.setVorname(eidData.getGivenName()); +      person.setGeburtsdatum(buildErnpBirthday(eidData.getDateOfBirth()));        +      ernpReq.setPersonendaten(person); +       +      buildNewEidasDocumens(ernpReq, eidData); +              +      // request ERnP +      log.trace("Requesting ERnP for '{}' operation", PROCESS_ADD_IDENITY);        +      AnlegenResponse ernpResp = ernpClient.anlegen(generic.getClientBehkz(), generic.clientName, +          generic.getClientRequestTime(), generic.getClientRequestId(), ernpReq);         +      log.trace("Receive response from ERnP for '{}' operation", PROCESS_ADD_IDENITY); +       +      return  new ErnpRegisterResult(Arrays.asList( +          mapErnpResponseToRegisterResult(ernpResp.getPerson(), eidData.getCitizenCountryCode())));     +    } catch (RestClientException e) { +      log.warn(LOGMSG_ERNP_ERROR, PROCESS_ADD_IDENITY, e.getMessage()); +      throw new EidasSAuthenticationException(ERROR_MATCHING_11, new Object[] { e.getMessage() }, e); +       +    } catch (final Exception e) { +      log.warn(LOGMSG_ERNP_RESP_PROCESS, PROCESS_ADD_IDENITY, e.getMessage()); +      throw new EidasSAuthenticationException(ERROR_MATCHING_99, new Object[] { e.getMessage() }, e); +       +    }        }    @Override @@ -629,21 +639,9 @@ public class ErnpRestClient implements IErnpClient {      Personendaten person = new Personendaten();      person.setEntityId(ernpPersonToKitt.getPersonendaten().getEntityId());      el.setPersonendaten(person); -     -    if (StringUtils.isNotEmpty(mdsToUpdate.getFamilyName())) { -      person.setFamilienname(mdsToUpdate.getFamilyName()); -       -    } -     -    if (StringUtils.isNotEmpty(mdsToUpdate.getGivenName())) { -      person.setVorname(mdsToUpdate.getGivenName()); -       -    } -     -    if (StringUtils.isNotEmpty(mdsToUpdate.getDateOfBirth())) { -      person.setGeburtsdatum(buildErnpBirthday(mdsToUpdate.getDateOfBirth())); -       -    }           +    person.setFamilienname(mdsToUpdate.getFamilyName()); +    person.setVorname(mdsToUpdate.getGivenName()); +    person.setGeburtsdatum(buildErnpBirthday(mdsToUpdate.getDateOfBirth()));                     return el;    } | 
