From dd9e461075a23bc75f9db708609a9d0f0ece3901 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 31 Aug 2018 13:13:07 +0200 Subject: more updates --- .../tasks/CreateIdentityLinkTask.java | 75 +++++++++++++++++----- 1 file changed, 59 insertions(+), 16 deletions(-) (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/tasks') diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/tasks/CreateIdentityLinkTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/tasks/CreateIdentityLinkTask.java index 9882bab2..fde56e7c 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/tasks/CreateIdentityLinkTask.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/tasks/CreateIdentityLinkTask.java @@ -33,6 +33,7 @@ import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants; import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.SZRCommunicationException; import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.eIDASAttributeException; import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.eIDASAuthenticationException; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.service.eIDASDataStore; import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.szr.SZRClient; import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.utils.eIDASResponseUtils; import at.gv.e_government.reference.namespace.persondata._20020228.PersonNameType; @@ -71,6 +72,7 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { //@Autowired private eIDASAttributeRegistry attrRegistry; @Autowired private IConfiguration basicConfig; @Autowired private SZRClient szrClient; + @Autowired private eIDASDataStore personalIdStore; /* (non-Javadoc) @@ -94,6 +96,7 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { Object familyNameObj = simpleAttrMap.get(Constants.eIDAS_ATTR_CURRENTFAMILYNAME); Object givenNameObj = simpleAttrMap.get(Constants.eIDAS_ATTR_CURRENTGIVENNAME); Object dateOfBirthObj = simpleAttrMap.get(Constants.eIDAS_ATTR_DATEOFBIRTH); + Object placeOfBirth = simpleAttrMap.get(Constants.eIDAS_ATTR_PLACEOFBIRTH); //check if availabe if (eIdentifierObj == null || !(eIdentifierObj instanceof String)) @@ -159,8 +162,8 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { PersonInfoType personInfo = new PersonInfoType(); PersonNameType personName = new PersonNameType(); PhysicalPersonType naturalPerson = new PhysicalPersonType(); - TravelDocumentType eDocument = new TravelDocumentType(); - + TravelDocumentType eDocument = new TravelDocumentType(); + naturalPerson.setName(personName ); personInfo.setPerson(naturalPerson ); personInfo.setTravelDocument(eDocument ); @@ -187,14 +190,27 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_EDOCUMENTTYPE, Constants.SZR_CONSTANTS_DEFAULT_DOCUMENT_TYPE)); - //TODO: that should be removed - eDocument.setIssueDate(basicConfig.getBasicConfiguration( - Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_DATE)); - eDocument.setIssuingAuthority(basicConfig.getBasicConfiguration( - Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_AUTHORITY)); + //set PlaceOfBirth if available + if (placeOfBirth != null && placeOfBirth instanceof String) { + log.trace("Find 'PlaceOfBirth' attribute: " + placeOfBirth); + if (basicConfig.getBasicMOAIDConfigurationBoolean( + Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_SETPLACEOFBIRTHIFAVAILABLE, + false)) { + naturalPerson.setPlaceOfBirth((String) placeOfBirth); + log.trace("Adding 'PlaceOfBirth' to ERnB request ... "); + + } + } - //TODO: keys are not available in eIDAS - List keyValue = dummyCodeForKeys(); + + + //TODO: that should be removed +// eDocument.setIssueDate(basicConfig.getBasicConfiguration( +// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_DATE)); +// eDocument.setIssuingAuthority(basicConfig.getBasicConfiguration( +// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_AUTHORITY)); + //List keyValue = dummyCodeForKeys(); + List keyValue = null; IdentityLinkType result = szrClient.getIdentityLinkInRawMode( personInfo, @@ -207,6 +223,25 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { Element idlFromSZR = (Element)result.getAssertion(); identityLink = new SimpleIdentityLinkAssertionParser(idlFromSZR).parseIdentityLink(); + //write ERnB inputdate into SQLite database + if (basicConfig.getBasicMOAIDConfigurationBoolean( + Constants.CONIG_PROPS_EIDAS_SZRCLIENT_WORKAROUND_SQLLITEDATASTORE_ACTIVE, true)) { + personalIdStore.storeNationalId( + pendingReq.getUniqueTransactionIdentifier(), + eIdentifier, + uniqueId); + + } + + //write ERnB inputdata into revisionlog + if (basicConfig.getBasicMOAIDConfigurationBoolean( + Constants.CONIG_PROPS_EIDAS_SZRCLIENT_WORKAROUND_SQLLITEDATASTORE_ACTIVE, false)) { + revisionsLogger.logEvent(pendingReq, + MSConnectorEventCodes.SZR_ERNB_EIDAS_RAW_ID, (String)eIdentifierObj); + revisionsLogger.logEvent(pendingReq, + MSConnectorEventCodes.SZR_ERNB_EIDAS_HASHED_ID, uniqueId); + + } //get bPK from SZR if (basicConfig.getBasicMOAIDConfigurationBoolean( @@ -354,29 +389,37 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { final Class parameterizedType = el.getParameterizedType(); if ((DateTime.class).equals(parameterizedType)) { DateTime attribute = eIDASResponseUtils.translateDateAttribute(el, attributeMap.get(el).asList()); - if (attribute != null) + if (attribute != null) { result.put(el.getFriendlyName(), attribute); - else + log.trace("Find attr '" + el.getFriendlyName() + "' with value: " + attribute.toString() ); + + } else log.info("Ignore empty 'DateTime' attribute"); } else if ((PostalAddress.class).equals(parameterizedType)) { PostalAddress addressAttribute = eIDASResponseUtils.translateAddressAttribute(el, attributeMap.get(el).asList()); - if (addressAttribute != null) + if (addressAttribute != null) { result.put(el.getFriendlyName(), addressAttribute); - else + log.trace("Find attr '" + el.getFriendlyName() + "' with value: " + addressAttribute.toString() ); + + } else log.info("Ignore empty 'PostalAddress' attribute"); } else { List natPersonIdObj = eIDASResponseUtils.translateStringListAttribute(el, attributeMap.get(el).asList()); String stringAttr = natPersonIdObj.get(0); - if (StringUtils.isNotEmpty(stringAttr)) + if (StringUtils.isNotEmpty(stringAttr)) { result.put(el.getFriendlyName(), stringAttr); - else + log.trace("Find attr '" + el.getFriendlyName() + "' with value: " + stringAttr ); + + } else log.info("Ignore empty 'String' attribute"); } } - + + log.debug("Receive #" + result.size() + " attributes with names: " + result.keySet().toString()); + return result; } -- cgit v1.2.3