aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2/src/main
diff options
context:
space:
mode:
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/Constants.java1
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java18
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ICountrySpecificDetailSearchProcessor.java29
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java16
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java71
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java17
6 files changed, 69 insertions, 83 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 7e07b5a3..ce48a88e 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
@@ -138,6 +138,7 @@ public class Constants {
public static final String eIDAS_ATTR_PLACEOFBIRTH = "PlaceOfBirth";
public static final String eIDAS_ATTR_BIRTHNAME = "BirthName";
public static final String eIDAS_ATTR_CURRENTADDRESS = "CurrentAddress";
+ public static final String eIDAS_ATTR_TAXREFERENCE = "TaxReference";
public static final String eIDAS_ATTR_LEGALPERSONIDENTIFIER = "LegalPersonIdentifier";
public static final String eIDAS_ATTR_LEGALNAME = "LegalName";
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java
index 9fa13fe8..51d6952f 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/DeSpecificDetailSearchProcessor.java
@@ -3,24 +3,10 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.handler;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.MergedRegisterSearchResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernb.IErnbClient;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.IZmrClient;
-import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
-public class DeSpecificDetailSearchProcessor implements ICountrySpecificDetailSearchProcessor {
-
- @Autowired
- private IErnbClient ernbClient;
-
- @Autowired
- private IZmrClient zmrClient;
-
- @Override
- public String getName() {
- return this.getClass().getName();
- }
+public class DeSpecificDetailSearchProcessor extends ICountrySpecificDetailSearchProcessor {
@Override
public boolean canHandle(String countryCode, SimpleEidasData eidData) {
@@ -47,7 +33,7 @@ public class DeSpecificDetailSearchProcessor implements ICountrySpecificDetailSe
ArrayList<RegisterResult> resultsErnb =
ernbClient.searchDeSpecific(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth(),
- eidData.getPlaceOfBirth(), eidData.getBirthName());
+ eidData.getPlaceOfBirth(), eidData.getBirthName());
searchResult.setResultsErnb(resultsErnb);
return searchResult;
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ICountrySpecificDetailSearchProcessor.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ICountrySpecificDetailSearchProcessor.java
index 887aef4a..3d6b35e9 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ICountrySpecificDetailSearchProcessor.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ICountrySpecificDetailSearchProcessor.java
@@ -25,25 +25,44 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.handler;
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.ernb.IErnbClient;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.IZmrClient;
+import org.springframework.beans.factory.annotation.Autowired;
-public interface ICountrySpecificDetailSearchProcessor {
+public abstract class ICountrySpecificDetailSearchProcessor {
+
+
+ protected IErnbClient ernbClient;
+ protected IZmrClient zmrClient;
+
+ @Autowired
+ public void setErnbClient(IErnbClient ernbClient) {
+ this.ernbClient = ernbClient;
+ }
+
+ @Autowired
+ public void setZmrClient(IZmrClient zmrClient) {
+ this.zmrClient = zmrClient;
+ }
/**
* Get a friendlyName of this post-processor implementation.
*
* @return
*/
- String getName();
+ public String getName() {
+ return this.getClass().getName();
+ }
/**
* Check if this postProcessor is sensitive for a specific country.
*
* @param countryCode of the eID data that should be processed
- * @param eidData eID data
+ * @param eidData eID data
* @return true if this implementation can handle the country, otherwise false
*/
- boolean canHandle(String countryCode, SimpleEidasData eidData);
+ public abstract boolean canHandle(String countryCode, SimpleEidasData eidData);
- MergedRegisterSearchResult search(SimpleEidasData eidData);
+ public abstract MergedRegisterSearchResult search(SimpleEidasData eidData);
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java
index e3b9e702..d055345a 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/ItSpecificDetailSearchProcessor.java
@@ -3,24 +3,10 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.handler;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.MergedRegisterSearchResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernb.IErnbClient;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.IZmrClient;
-import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
-public class ItSpecificDetailSearchProcessor implements ICountrySpecificDetailSearchProcessor {
-
- @Autowired
- private IErnbClient ernbClient;
-
- @Autowired
- private IZmrClient zmrClient;
-
- @Override
- public String getName() {
- return this.getClass().getName();
- }
+public class ItSpecificDetailSearchProcessor extends ICountrySpecificDetailSearchProcessor {
@Override
public boolean canHandle(String countryCode, SimpleEidasData eidData) {
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 e9422c56..2ae278dc 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
@@ -53,12 +53,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
-import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -71,52 +69,14 @@ import java.util.Map;
@Component("InitialSearchTask")
public class InitialSearchTask extends AbstractAuthServletTask {
- private final List<ICountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
+ private List<ICountrySpecificDetailSearchProcessor> handlers = new ArrayList<>();
- // @Autowired
- // private AuthBlockSigningService authBlockSigner;
- // @Autowired
- // private IConfiguration basicConfig;
- // @Autowired
- // private SzrClient szrClient;
- // @Autowired
- // private ICcSpecificEidProcessingService eidPostProcessor;
-
- // private static final String EID_STATUS = "urn:eidgvat:eid.status.eidas";
@Autowired
private ApplicationContext context;
- @Autowired
private IErnbClient ernbClient;
-
- @Autowired
private IZmrClient zmrClient;
- @PostConstruct
- private void initialize() {
- log.debug("Initialize country specific detail search services ... ");
- final Map<String, ICountrySpecificDetailSearchProcessor> postProcessors = context.getBeansOfType(
- ICountrySpecificDetailSearchProcessor.class);
- final Iterator<Map.Entry<String, ICountrySpecificDetailSearchProcessor>> iterator =
- postProcessors.entrySet().iterator();
- while (iterator.hasNext()) {
- final Map.Entry<String, ICountrySpecificDetailSearchProcessor> el = iterator.next();
- log.debug("Find country specific detail search services with name: " + el.getKey());
- handlers.add(el.getValue());
-
- }
-
- // log.trace("Sorting country specific detail search services on priority ... ");
- // Collections.sort(handlers, (thisAuthModule, otherAuthModule) -> {
- // final int thisOrder = thisAuthModule.getPriority();
- // final int otherOrder = otherAuthModule.getPriority();
- // return thisOrder < otherOrder ? 1 : thisOrder == otherOrder ? 0 : -1;
- // });
-
- log.info("# " + handlers.size() + " country specific detail search services are registrated");
-
- }
-
/*
* (non-Javadoc)
*
@@ -133,6 +93,9 @@ public class InitialSearchTask extends AbstractAuthServletTask {
final ILightResponse eidasResponse = authProcessData
.getGenericDataFromSession(Constants.DATA_FULL_EIDAS_RESPONSE, ILightResponse.class);
+ ImmutableMap<AttributeDefinition<?>, ImmutableSet<? extends AttributeValue<?>>> aa =
+ eidasResponse.getAttributes().getAttributeMap();
+
final Map<String, Object> simpleAttrMap = convertEidasAttrToSimpleMap(
eidasResponse.getAttributes().getAttributeMap());
@@ -140,7 +103,7 @@ public class InitialSearchTask extends AbstractAuthServletTask {
final SimpleEidasData eidData = convertSimpleMapToSimpleData(simpleAttrMap);
String bpK = step2(eidData);
- authProcessData.setGenericDataToSession(Constants.DATA_RESULT_MATCHING_BPK,bpK);
+ authProcessData.setGenericDataToSession(Constants.DATA_RESULT_MATCHING_BPK, bpK);
} catch (final Exception e) {
log.error("Initial search FAILED.", e);
throw new TaskExecutionException(pendingReq, "Initial search FAILED.", e);
@@ -157,7 +120,7 @@ public class InitialSearchTask extends AbstractAuthServletTask {
return step3(result, eidData);
} //else if (result.getResultCount() > 1) {
throw new TaskExecutionException(pendingReq, "Initial search - Kitt Process necessary.",
- new ManualFixNecessaryException(personIdentifier));
+ new ManualFixNecessaryException(personIdentifier));
// }
// return null;
}
@@ -189,6 +152,11 @@ public class InitialSearchTask extends AbstractAuthServletTask {
simpleEidasData.setAddress(EidasResponseUtils.processAddress(
eidasAttrMap.get(Constants.eIDAS_ATTR_CURRENTADDRESS)));
+ if (eidasAttrMap.containsKey(Constants.eIDAS_ATTR_TAXREFERENCE)) {
+ simpleEidasData.setTaxNumber(EidasResponseUtils.processTaxReference(
+ eidasAttrMap.get(Constants.eIDAS_ATTR_TAXREFERENCE)));
+ }
+
//TODO other additional attributes
return simpleEidasData;
}
@@ -211,10 +179,10 @@ public class InitialSearchTask extends AbstractAuthServletTask {
}
private String step4(MergedRegisterSearchResult result,
- SimpleEidasData eidData) throws WorkflowException {
+ SimpleEidasData eidData) throws WorkflowException {
log.debug("Update " + result + " with " + eidData);
//TODO
-
+
return result.getBpk();
}
@@ -242,7 +210,7 @@ public class InitialSearchTask extends AbstractAuthServletTask {
}
private String step6(ICountrySpecificDetailSearchProcessor countrySpecificDetailSearchProcessor,
- MergedRegisterSearchResult initialSearchResult, SimpleEidasData eidData)
+ MergedRegisterSearchResult initialSearchResult, SimpleEidasData eidData)
throws TaskExecutionException {
//6 country specific search
MergedRegisterSearchResult countrySpecificDetailSearchResult =
@@ -274,7 +242,7 @@ public class InitialSearchTask extends AbstractAuthServletTask {
}
private String step8(MergedRegisterSearchResult initialSearchResult,
- SimpleEidasData eidData) {
+ SimpleEidasData eidData) {
MergedRegisterSearchResult mdsSearchResult = new MergedRegisterSearchResult();
ArrayList<RegisterResult> resultsZmr =
@@ -351,11 +319,20 @@ public class InitialSearchTask extends AbstractAuthServletTask {
//just for testing
//TODO is there a nicer solution?
+ @Autowired
public void setErnbClient(IErnbClient ernbClient) {
this.ernbClient = ernbClient;
}
+ @Autowired
public void setZmrClient(IZmrClient zmrClient) {
this.zmrClient = zmrClient;
}
+
+ @Autowired
+ public void setHandlers(List<ICountrySpecificDetailSearchProcessor> handlers) {
+ this.handlers = handlers;
+ log.info("# " + handlers.size() + " country specific detail search services are registrated");
+ }
+
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
index 5a1db0e0..55c1c31a 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/EidasResponseUtils.java
@@ -352,6 +352,23 @@ public class EidasResponseUtils {
EidasResponseUtils.parseEidasPersonalIdentifier((String) personalIdObj);
return eIdentifier.getThird();
+ }
+
+ /**
+ * Post-Process the eIDAS TaxReference attribute.
+ *
+ * @param taxReferenceObj eIDAS TaxReference attribute information
+ * @return formated user's TaxReference
+ * @throws EidasAttributeException if NO attribute is available
+ * @throws EidPostProcessingException if post-processing fails
+ */
+ public static String processTaxReference(Object taxReferenceObj) throws EidPostProcessingException,
+ EidasAttributeException {
+ if (taxReferenceObj == null || !(taxReferenceObj instanceof String)) {
+ throw new EidasAttributeException(Constants.eIDAS_ATTR_CURRENTGIVENNAME);
+ }
+
+ return (String) taxReferenceObj;
}
}