aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2/src/main
diff options
context:
space:
mode:
authorChristian Kollmann <christian.kollmann@a-sit.at>2021-03-04 17:47:41 +0100
committerChristian Kollmann <christian.kollmann@a-sit.at>2021-03-04 17:47:41 +0100
commit27f2e48e6a585e2d1462b60214b5cfcd8f40680b (patch)
tree9825839ab326ba77c7c4682bd7fcc77bee924a70 /eidas_modules/authmodule-eIDAS-v2/src/main
parent9df463ce8c8567a8f70c4f8f1988f5ae299b6369 (diff)
downloadNational_eIDAS_Gateway-27f2e48e6a585e2d1462b60214b5cfcd8f40680b.tar.gz
National_eIDAS_Gateway-27f2e48e6a585e2d1462b60214b5cfcd8f40680b.tar.bz2
National_eIDAS_Gateway-27f2e48e6a585e2d1462b60214b5cfcd8f40680b.zip
Copy post processing eIDAS attributes to InitialSearchTask
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java1
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/AbstractEidProcessor.java11
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java2
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java43
4 files changed, 19 insertions, 38 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java
index 748994bb..9409509b 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java
@@ -35,6 +35,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
@Builder
public class SimpleEidasData {
+ private final String personalIdentifier;
private final String citizenCountryCode;
// MDS
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/AbstractEidProcessor.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/AbstractEidProcessor.java
index f97517d5..6d067e69 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/AbstractEidProcessor.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/AbstractEidProcessor.java
@@ -54,6 +54,7 @@ import eu.eidas.auth.commons.light.impl.LightRequest.Builder;
import eu.eidas.auth.commons.protocol.eidas.SpType;
import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.eIDAS_ATTR_PERSONALIDENTIFIER;
+import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.eIDAS_ATTR_TAXREFERENCE;
import static at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils.processCountryCode;
import static at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils.processDateOfBirthToString;
@@ -77,7 +78,7 @@ public abstract class AbstractEidProcessor implements INationalEidProcessor {
@Override
public final SimpleEidasData postProcess(Map<String, Object> eidasAttrMap) throws EidPostProcessingException,
EidasAttributeException {
- return SimpleEidasData.builder()
+ SimpleEidasData.SimpleEidasDataBuilder builder = SimpleEidasData.builder()
// MDS attributes
.citizenCountryCode(processCountryCode(eidasAttrMap.get(eIDAS_ATTR_PERSONALIDENTIFIER)))
.pseudonym(processPseudonym(eidasAttrMap.get(Constants.eIDAS_ATTR_PERSONALIDENTIFIER)))
@@ -87,9 +88,11 @@ public abstract class AbstractEidProcessor implements INationalEidProcessor {
// additional attributes
.placeOfBirth(processPlaceOfBirth(eidasAttrMap.get(Constants.eIDAS_ATTR_PLACEOFBIRTH)))
.birthName(processBirthName(eidasAttrMap.get(Constants.eIDAS_ATTR_BIRTHNAME)))
- .address(processAddress(eidasAttrMap.get(Constants.eIDAS_ATTR_CURRENTADDRESS)))
- //.taxNumber(processTaxReference(eidasAttrMap.get(Constants.eIDAS_ATTR_TAXREFERENCE)))
- .build();
+ .address(processAddress(eidasAttrMap.get(Constants.eIDAS_ATTR_CURRENTADDRESS)));
+ if (eidasAttrMap.containsKey(eIDAS_ATTR_TAXREFERENCE)) {
+ builder.taxNumber(EidasResponseUtils.processTaxReference(eidasAttrMap.get(eIDAS_ATTR_TAXREFERENCE)));
+ }
+ return builder.build();
}
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 f70f0f85..66e7eb65 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
@@ -134,10 +134,10 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask {
.getGenericDataFromSession(Constants.DATA_FULL_EIDAS_RESPONSE, ILightResponse.class);
final Map<String, Object> eidasAttributes = convertEidasAttrToSimpleMap(
eidasResponse.getAttributes().getAttributeMap());
- final String personalIdentifier = (String) eidasAttributes.get(Constants.eIDAS_ATTR_PERSONALIDENTIFIER);
final SimpleEidasData eidData = eidPostProcessor.postProcess(eidasAttributes);
//final SimpleEidasData eidData =
getAuthProcessDataWrapper().getGenericDataFromSession(Constants.DATA_SIMPLE_EIDAS, SimpleEidasData.class);
+ final String personalIdentifier = (String) eidasAttributes.get(Constants.eIDAS_ATTR_PERSONALIDENTIFIER);
writeMdsLogInformation(eidData);
if (basicConfig.getBasicConfigurationBoolean(Constants.CONIG_PROPS_EIDAS_SZRCLIENT_DEBUG_USEDUMMY, false)) {
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java
index 89b5444f..b917de21 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java
@@ -26,10 +26,12 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.MergedRegisterSearchResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidPostProcessingException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasAttributeException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.ManualFixNecessaryException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.WorkflowException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.CountrySpecificDetailSearchProcessor;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.ICcSpecificEidProcessingService;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.RegisterSearchService;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils;
import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
@@ -58,14 +60,6 @@ import java.util.Map;
import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK;
import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.eIDAS_ATTR_BIRTHNAME;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.eIDAS_ATTR_CURRENTADDRESS;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.eIDAS_ATTR_CURRENTFAMILYNAME;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.eIDAS_ATTR_CURRENTGIVENNAME;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.eIDAS_ATTR_DATEOFBIRTH;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.eIDAS_ATTR_PERSONALIDENTIFIER;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.eIDAS_ATTR_PLACEOFBIRTH;
-import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.eIDAS_ATTR_TAXREFERENCE;
/**
* Task that searches registers (ERnP and ZMR) before adding person to SZR.
@@ -101,17 +95,20 @@ public class InitialSearchTask extends AbstractAuthServletTask {
private final List<CountrySpecificDetailSearchProcessor> handlers;
private final RegisterSearchService registerSearchService;
+ private final ICcSpecificEidProcessingService eidPostProcessor;
/**
* Constructor.
- *
- * @param handlers List of countrySpecificSearchProcessors
+ * @param handlers List of countrySpecificSearchProcessors
* @param registerSearchService Service for register search access
+ * @param eidPostProcessor Country-Specific post processing of attributes
*/
public InitialSearchTask(List<CountrySpecificDetailSearchProcessor> handlers,
- RegisterSearchService registerSearchService) {
+ RegisterSearchService registerSearchService,
+ ICcSpecificEidProcessingService eidPostProcessor) {
this.registerSearchService = registerSearchService;
this.handlers = handlers;
+ this.eidPostProcessor = eidPostProcessor;
log.info("Init with {} country specific detail search services", handlers.size());
}
@@ -237,31 +234,11 @@ public class InitialSearchTask extends AbstractAuthServletTask {
@NotNull
private SimpleEidasData convertEidasAttrToSimpleData()
- throws EidasAttributeException {
+ throws EidasAttributeException, EidPostProcessingException {
final ILightResponse eidasResponse = getAuthProcessDataWrapper()
.getGenericDataFromSession(Constants.DATA_FULL_EIDAS_RESPONSE, ILightResponse.class);
Map<String, Object> simpleMap = convertEidasAttrToSimpleMap(eidasResponse.getAttributes().getAttributeMap());
- return convertSimpleMapToSimpleData(simpleMap);
- }
-
- private SimpleEidasData convertSimpleMapToSimpleData(Map<String, Object> eidasAttrMap)
- throws EidasAttributeException {
- SimpleEidasData.SimpleEidasDataBuilder builder = SimpleEidasData.builder()
- .citizenCountryCode(EidasResponseUtils.processCountryCode(eidasAttrMap.get(eIDAS_ATTR_PERSONALIDENTIFIER)))
- // MDS attributes
- .pseudonym(EidasResponseUtils.processPseudonym(eidasAttrMap.get(eIDAS_ATTR_PERSONALIDENTIFIER)))
- .familyName(EidasResponseUtils.processFamilyName(eidasAttrMap.get(eIDAS_ATTR_CURRENTFAMILYNAME)))
- .givenName(EidasResponseUtils.processGivenName(eidasAttrMap.get(eIDAS_ATTR_CURRENTGIVENNAME)))
- .dateOfBirth(EidasResponseUtils.processDateOfBirthToString(eidasAttrMap.get(eIDAS_ATTR_DATEOFBIRTH)))
- // additional attributes
- .placeOfBirth(EidasResponseUtils.processPlaceOfBirth(eidasAttrMap.get(eIDAS_ATTR_PLACEOFBIRTH)))
- .birthName(EidasResponseUtils.processBirthName(eidasAttrMap.get(eIDAS_ATTR_BIRTHNAME)))
- .address(EidasResponseUtils.processAddress(eidasAttrMap.get(eIDAS_ATTR_CURRENTADDRESS)));
- if (eidasAttrMap.containsKey(eIDAS_ATTR_TAXREFERENCE)) {
- builder.taxNumber(EidasResponseUtils.processTaxReference(eidasAttrMap.get(eIDAS_ATTR_TAXREFERENCE)));
- }
- //TODO other additional attributes
- return builder.build();
+ return eidPostProcessor.postProcess(simpleMap);
}
private Map<String, Object> convertEidasAttrToSimpleMap(