diff options
author | Thomas <> | 2022-04-01 21:47:48 +0200 |
---|---|---|
committer | Thomas <> | 2022-04-01 21:47:48 +0200 |
commit | 49a945fa17ee06f38ddada441df7a1f29c58e317 (patch) | |
tree | fcdff1e3a191a7479ed9468b4f5672b75859ad19 /eidas_modules/authmodule-eIDAS-v2/src/main | |
parent | d23001c7436559fade8647ffdaa158080c05f0b7 (diff) | |
download | National_eIDAS_Gateway-49a945fa17ee06f38ddada441df7a1f29c58e317.tar.gz National_eIDAS_Gateway-49a945fa17ee06f38ddada441df7a1f29c58e317.tar.bz2 National_eIDAS_Gateway-49a945fa17ee06f38ddada441df7a1f29c58e317.zip |
feat(szr): add configuration property to activate/deactivate work-around for insertErnp in case of IDA mode
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main')
3 files changed, 46 insertions, 10 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java index 1732a61a..08b1b315 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java @@ -132,6 +132,10 @@ public class Constants { public static final String CONIG_PROPS_EIDAS_SZRCLIENT_WORKAROUND_SQLLITEDATASTORE_ACTIVE = CONIG_PROPS_EIDAS_SZRCLIENT + ".workarounds.datastore.sqlite.active"; + public static final String CONIG_PROPS_EIDAS_SZRCLIENT_WORKAROUND_IDA_VSZ_IDL = + CONIG_PROPS_EIDAS_SZRCLIENT + ".workarounds.use.getidentitylink.for.ida"; + + // http endpoint descriptions public static final String eIDAS_HTTP_ENDPOINT_SP_POST = "/eidas/light/sp/post"; public static final String eIDAS_HTTP_ENDPOINT_SP_REDIRECT = "/eidas/light/sp/redirect"; diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java index 5558fdfd..e000a2e4 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java @@ -226,15 +226,15 @@ public class SzrClient { * Request a encryped baseId from SRZ. * * @param personInfo Minimum dataset of person + * @param insertErnp insertErnp flag on SZR request * @return encrypted baseId * @throws SzrCommunicationException In case of a SZR error */ - public String getEncryptedStammzahl(final PersonInfoType personInfo) - throws SzrCommunicationException { - + public String getEncryptedStammzahl(final PersonInfoType personInfo, boolean insertErnp) + throws SzrCommunicationException{ final String resp; try { - resp = this.szr.getStammzahlEncrypted(personInfo, false); + resp = this.szr.getStammzahlEncrypted(personInfo, insertErnp); } catch (SZRException_Exception e) { throw new SzrCommunicationException("ernb.02", new Object[]{e.getMessage()}, e); } @@ -244,6 +244,23 @@ public class SzrClient { } return resp; + + } + + + + + + /** + * Request a encrypted baseId from SRZ without insertErnp. + * + * @param personInfo Minimum dataset of person + * @return encrypted baseId + * @throws SzrCommunicationException In case of a SZR error + */ + public String getEncryptedStammzahl(final PersonInfoType personInfo) + throws SzrCommunicationException { + return getEncryptedStammzahl(personInfo, false); } 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 4a501ed6..d08d8362 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 @@ -150,12 +150,9 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { if (pendingReq.getServiceProviderConfiguration() .isConfigurationValue(MsEidasNodeConstants.PROP_CONFIG_SP_NEW_EID_MODE, false)) { - // work-around, because getEncryptedStammzahl does not support insertERnP for eIDAS entities - SzrResultHolder idlResult = requestSzrForIdentityLink(personInfo); - - // get encrypted baseId - String vsz = szrClient.getEncryptedStammzahl(buildGetEncryptedBaseIdReq(idlResult.identityLink)); - + // get VSZ + String vsz = getVszForPerson(personInfo); + //write revision-Log entry and extended infos personal-identifier mapping revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.SZR_VSZ_RECEIVED); writeExtendedRevisionLogEntry(simpleAttrMap, eidData); @@ -224,6 +221,24 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { } } + private String getVszForPerson(PersonInfoType personInfo) throws SzrCommunicationException, EaafException { + if (basicConfig.getBasicConfigurationBoolean( + Constants.CONIG_PROPS_EIDAS_SZRCLIENT_WORKAROUND_IDA_VSZ_IDL, true)) { + log.debug("IDA workaround is active. Requesting IDL to insert person into ERnP .... "); + + // work-around, because getEncryptedStammzahl does not support insertERnP for eIDAS entities + SzrResultHolder idlResult = requestSzrForIdentityLink(personInfo); + + // get encrypted baseId + return szrClient.getEncryptedStammzahl(buildGetEncryptedBaseIdReq(idlResult.identityLink)); + + + } else { + return szrClient.getEncryptedStammzahl(personInfo, true); + + } + } + private PersonInfoType buildGetEncryptedBaseIdReq(IIdentityLink identityLink) throws EaafBuilderException { log.debug("Generating getVsz request from identityLink information ... "); final PersonInfoType personInfo = new PersonInfoType(); |