aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/tasks/CreateIdentityLinkTask.java
diff options
context:
space:
mode:
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/tasks/CreateIdentityLinkTask.java')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/tasks/CreateIdentityLinkTask.java75
1 files changed, 59 insertions, 16 deletions
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<KeyValueType> 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<KeyValueType> keyValue = dummyCodeForKeys();
+ List<KeyValueType> 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<String> 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;
}