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.java2
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java57
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java134
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAustrianResidenceGuiResponseTask.java2
4 files changed, 104 insertions, 91 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 c6d24e34..c2fc44b9 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
@@ -183,7 +183,7 @@ public class Constants {
public static final String COUNTRY_CODE_DE = "DE";
public static final String COUNTRY_CODE_IT = "IT";
- public static final String TRANSITION_TO_CREATE_NEW_ERNB_ENTRY_TASK = "TASK_CreateNewErnpEntryTask";
+ public static final String TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK = "TASK_CreateNewErnpEntryTask";
public static final String TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK =
"TASK_GenerateOtherLoginMethodGuiTask";
public static final String TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK =
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java
index a3062d0d..6a41893b 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java
@@ -30,14 +30,14 @@ public class RegisterSearchService {
*
* @param initialSearchResult Result of initial register search
* @param specificDetailSearchResult Result of last register search
- * @param eidData Received eidas data
+ * @param eidasData Received eidas data
* @param pendingReq Pending request
* @return The bpk
* @throws TaskExecutionException if an error occurs during the register update
*/
public String step7aKittProcess(MergedRegisterSearchResult initialSearchResult,
MergedRegisterSearchResult specificDetailSearchResult,
- SimpleEidasData eidData, IRequest pendingReq) throws TaskExecutionException {
+ SimpleEidasData eidasData, IRequest pendingReq) throws TaskExecutionException {
try {
if (initialSearchResult.getResultCount() != 0) {
throw new WorkflowException("initialSearchResult.getResultCount() != 0");
@@ -46,10 +46,10 @@ public class RegisterSearchService {
throw new WorkflowException("countrySpecificDetailSearchResult.getResultCount() != 1");
}
if (specificDetailSearchResult.getResultsZmr().size() == 1) {
- zmrClient.update(specificDetailSearchResult.getResultsZmr().get(0), eidData);
+ zmrClient.update(specificDetailSearchResult.getResultsZmr().get(0), eidasData);
}
if (specificDetailSearchResult.getResultsErnp().size() == 1) {
- ernpClient.update(specificDetailSearchResult.getResultsErnp().get(0), eidData);
+ ernpClient.update(specificDetailSearchResult.getResultsErnp().get(0), eidasData);
}
return specificDetailSearchResult.getBpk();
} catch (WorkflowException e) {
@@ -57,39 +57,54 @@ public class RegisterSearchService {
}
}
- public MergedRegisterSearchResult searchWithMds(SimpleEidasData eidData) {
+ /**
+ * Search with MDS (Given Name, Family Name, Date of Birth) in ZMR and ERnP.
+ */
+ public MergedRegisterSearchResult searchWithMds(SimpleEidasData eidasData) {
List<RegisterResult> resultsZmr =
- zmrClient.searchWithMds(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth());
+ zmrClient.searchWithMds(eidasData.getGivenName(), eidasData.getFamilyName(), eidasData.getDateOfBirth());
List<RegisterResult> resultsErnp =
- ernpClient.searchWithMds(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth());
+ ernpClient.searchWithMds(eidasData.getGivenName(), eidasData.getFamilyName(), eidasData.getDateOfBirth());
return new MergedRegisterSearchResult(resultsZmr, resultsErnp);
}
- public MergedRegisterSearchResult searchWithPersonIdentifier(SimpleEidasData eidData) {
- List<RegisterResult> resultsZmr = zmrClient.searchWithPersonIdentifier(eidData.getPseudonym());
- List<RegisterResult> resultsErnp = ernpClient.searchWithPersonIdentifier(eidData.getPseudonym());
+ /**
+ * Search with Person Identifier (eIDAS Pseudonym) in ZMR and ERnP.
+ */
+ public MergedRegisterSearchResult searchWithPersonIdentifier(SimpleEidasData eidasData) {
+ List<RegisterResult> resultsZmr = zmrClient.searchWithPersonIdentifier(eidasData.getPseudonym());
+ List<RegisterResult> resultsErnp = ernpClient.searchWithPersonIdentifier(eidasData.getPseudonym());
return new MergedRegisterSearchResult(resultsZmr, resultsErnp);
}
- public MergedRegisterSearchResult searchItSpecific(SimpleEidasData eidData) {
- List<RegisterResult> resultsZmr = zmrClient.searchItSpecific(eidData.getTaxNumber());
- List<RegisterResult> resultsErnb = ernpClient.searchItSpecific(eidData.getTaxNumber());
+ /**
+ * Search with Tax Number in ZMR and ERnP.
+ */
+ public MergedRegisterSearchResult searchItSpecific(SimpleEidasData eidasData) {
+ List<RegisterResult> resultsZmr = zmrClient.searchItSpecific(eidasData.getTaxNumber());
+ List<RegisterResult> resultsErnb = ernpClient.searchItSpecific(eidasData.getTaxNumber());
return new MergedRegisterSearchResult(resultsZmr, resultsErnb);
}
- public MergedRegisterSearchResult searchDeSpecific(SimpleEidasData eidData) {
+ /**
+ * Search with Given Name, Family Name, Date of Birth, Place of Birth and Birth Name in ZMR and ERnP.
+ */
+ public MergedRegisterSearchResult searchDeSpecific(SimpleEidasData eidasData) {
List<RegisterResult> resultsZmr =
- zmrClient.searchDeSpecific(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth(),
- eidData.getPlaceOfBirth(), eidData.getBirthName());
+ zmrClient.searchDeSpecific(eidasData.getGivenName(), eidasData.getFamilyName(), eidasData.getDateOfBirth(),
+ eidasData.getPlaceOfBirth(), eidasData.getBirthName());
List<RegisterResult> resultsErnb =
- ernpClient.searchDeSpecific(eidData.getGivenName(), eidData.getFamilyName(), eidData.getDateOfBirth(),
- eidData.getPlaceOfBirth(), eidData.getBirthName());
+ ernpClient.searchDeSpecific(eidasData.getGivenName(), eidasData.getFamilyName(), eidasData.getDateOfBirth(),
+ eidasData.getPlaceOfBirth(), eidasData.getBirthName());
return new MergedRegisterSearchResult(resultsZmr, resultsErnb);
}
- public MergedRegisterSearchResult searchWithBpkZp(String bpkzp) {
- List<RegisterResult> resultsZmr = zmrClient.searchWithBpkZp(bpkzp);
- List<RegisterResult> resultsErnp = ernpClient.searchWithBpkZp(bpkzp);
+ /**
+ * Search with BPK-ZP in BMR and ERnP.
+ */
+ public MergedRegisterSearchResult searchWithBpkZp(String bpkZp) {
+ List<RegisterResult> resultsZmr = zmrClient.searchWithBpkZp(bpkZp);
+ List<RegisterResult> resultsErnp = ernpClient.searchWithBpkZp(bpkZp);
return new MergedRegisterSearchResult(resultsZmr, resultsErnp);
}
}
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 4fdf3cd2..8a2cac0d 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
@@ -44,6 +44,7 @@ import eu.eidas.auth.commons.protocol.eidas.impl.PostalAddress;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.joda.time.DateTime;
import org.springframework.stereotype.Component;
@@ -91,114 +92,115 @@ public class InitialSearchTask extends AbstractAuthServletTask {
final String bpk = step2RegisterSearchWithPersonIdentifier(executionContext, eidasData, authProcessData);
authProcessData.setGenericDataToSession(DATA_RESULT_MATCHING_BPK, bpk);
authProcessData.setGenericDataToSession(DATA_SIMPLE_EIDAS, eidasData);
+ } catch (final TaskExecutionException e) {
+ log.error("Initial search failed", e);
+ throw e;
} catch (final Exception e) {
- log.error("Initial search FAILED.", e);
- throw new TaskExecutionException(pendingReq, "Initial search FAILED.", e);
+ log.error("Initial search failed", e);
+ throw new TaskExecutionException(pendingReq, "Initial search failed", e);
}
}
private String step2RegisterSearchWithPersonIdentifier(
- ExecutionContext executionContext, SimpleEidasData eidData, AuthProcessDataWrapper authProcessData)
- throws TaskExecutionException {
+ ExecutionContext executionContext, SimpleEidasData eidasData, AuthProcessDataWrapper authProcessData)
+ throws TaskExecutionException, EaafStorageException, ManualFixNecessaryException {
log.trace("Starting step2RegisterSearchWithPersonIdentifier");
- String personIdentifier = eidData.getPseudonym();
- MergedRegisterSearchResult result = registerSearchService.searchWithPersonIdentifier(eidData);
- //store data in session
- try {
- authProcessData.setGenericDataToSession(DATA_INITIAL_REGISTER_RESULT, result);
- } catch (EaafStorageException e) {
- throw new TaskExecutionException(pendingReq, "Initial search - Kitt Process necessary.", e);
- }
- if (result.getResultCount() == 0) {
- return step5CheckAndPerformCountrySpecificSearchIfPossible(executionContext, result, eidData);
- } else if (result.getResultCount() == 1) {
- return step3CheckRegisterUpdateNecessary(result, eidData);
+ String personIdentifier = eidasData.getPseudonym();
+ MergedRegisterSearchResult registerData = registerSearchService.searchWithPersonIdentifier(eidasData);
+ authProcessData.setGenericDataToSession(DATA_INITIAL_REGISTER_RESULT, registerData);
+ switch (registerData.getResultCount()) {
+ case 0:
+ return step5CheckAndPerformCountrySpecificSearchIfPossible(executionContext, registerData, eidasData);
+ case 1:
+ return step3CheckRegisterUpdateNecessary(registerData, eidasData);
+ default:
+ throw new ManualFixNecessaryException(personIdentifier);
}
- throw new TaskExecutionException(pendingReq, "Initial search - Kitt Process necessary.",
- new ManualFixNecessaryException(personIdentifier));
}
- private String step3CheckRegisterUpdateNecessary(MergedRegisterSearchResult result, SimpleEidasData eidData)
- throws TaskExecutionException {
+ private String step3CheckRegisterUpdateNecessary(MergedRegisterSearchResult registerData, SimpleEidasData eidasData)
+ throws ManualFixNecessaryException {
log.trace("Starting step3CheckRegisterUpdateNecessary");
try {
- if (eidData.equalsRegisterData(result)) {
- //No update necessary, just return bpk
- return result.getBpk();
+ if (eidasData.equalsRegisterData(registerData)) {
+ return registerData.getBpk();
} else {
- return step4UpdateRegisterData(result, eidData);
+ return step4UpdateRegisterData(registerData, eidasData);
}
} catch (WorkflowException e) {
- throw new TaskExecutionException(pendingReq, "Initial search - Kitt Process necessary.", e);
+ throw new ManualFixNecessaryException(eidasData);
}
}
- private String step4UpdateRegisterData(MergedRegisterSearchResult result,
- SimpleEidasData eidData) throws WorkflowException {
+ private String step4UpdateRegisterData(MergedRegisterSearchResult registerData, SimpleEidasData eidasData)
+ throws WorkflowException {
log.trace("Starting step4UpdateRegisterData");
- log.debug("Update {} with {}", result, eidData);
+ log.debug("Update {} with {}", registerData, eidasData);
//TODO wann rechtlich möglich?
- return result.getBpk();
+ return registerData.getBpk();
}
private String step5CheckAndPerformCountrySpecificSearchIfPossible(
- ExecutionContext executionContext, MergedRegisterSearchResult result, SimpleEidasData eidData)
- throws TaskExecutionException {
+ ExecutionContext executionContext, MergedRegisterSearchResult registerData, SimpleEidasData eidasData)
+ throws TaskExecutionException, ManualFixNecessaryException {
log.trace("Starting step5CheckAndPerformCountrySpecificSearchIfPossible");
- String citizenCountry = eidData.getCitizenCountryCode();
- CountrySpecificDetailSearchProcessor foundHandler = null;
- for (final CountrySpecificDetailSearchProcessor el : handlers) {
- if (el.canHandle(citizenCountry, eidData)) {
- log.debug("Found suitable country specific search handler for {} by using: {}", citizenCountry, el.getName());
- foundHandler = el;
- break;
- }
- }
- if (foundHandler == null) {
- return step8RegisterSearchWithMds(executionContext, eidData);
+ CountrySpecificDetailSearchProcessor specificHandler = findSpecificProcessor(eidasData);
+ if (specificHandler != null) {
+ return step6CountrySpecificSearch(executionContext, specificHandler, registerData, eidasData);
} else {
- return step6CountrySpecificSearch(executionContext, foundHandler, result, eidData);
+ return step8RegisterSearchWithMds(executionContext, eidasData);
}
}
+ @Nullable
+ private CountrySpecificDetailSearchProcessor findSpecificProcessor(SimpleEidasData eidasData) {
+ final String citizenCountry = eidasData.getCitizenCountryCode();
+ for (final CountrySpecificDetailSearchProcessor processor : handlers) {
+ if (processor.canHandle(citizenCountry, eidasData)) {
+ log.debug("Found suitable search handler for {} by using: {}", citizenCountry, processor.getName());
+ return processor;
+ }
+ }
+ return null;
+ }
+
private String step6CountrySpecificSearch(ExecutionContext executionContext,
- CountrySpecificDetailSearchProcessor countrySpecificDetailSearchProcessor,
- MergedRegisterSearchResult initialSearchResult,
- SimpleEidasData eidData) throws TaskExecutionException {
+ CountrySpecificDetailSearchProcessor processor,
+ MergedRegisterSearchResult registerData,
+ SimpleEidasData eidasData)
+ throws TaskExecutionException, ManualFixNecessaryException {
log.trace("Starting step6CountrySpecificSearch");
- MergedRegisterSearchResult countrySpecificDetailSearchResult =
- countrySpecificDetailSearchProcessor.search(eidData);
-
- switch (countrySpecificDetailSearchResult.getResultCount()) {
+ MergedRegisterSearchResult countrySearchResult = processor.search(eidasData);
+ switch (countrySearchResult.getResultCount()) {
case 0:
- return step8RegisterSearchWithMds(executionContext, eidData);
+ return step8RegisterSearchWithMds(executionContext, eidasData);
case 1:
- return step7aKittProcess(initialSearchResult, countrySpecificDetailSearchResult, eidData);
+ return step7aKittProcess(registerData, countrySearchResult, eidasData);
default:
- throw new TaskExecutionException(pendingReq, "Detail search - Kitt Process necessary.",
- new ManualFixNecessaryException(eidData));
+ throw new ManualFixNecessaryException(eidasData);
}
}
- private String step7aKittProcess(MergedRegisterSearchResult initialSearchResult,
+ private String step7aKittProcess(MergedRegisterSearchResult registerData,
MergedRegisterSearchResult countrySpecificDetailSearchResult,
- SimpleEidasData eidData) throws TaskExecutionException {
+ SimpleEidasData eidasData) throws TaskExecutionException {
log.trace("Starting step7aKittProcess");
- return registerSearchService.step7aKittProcess(initialSearchResult, countrySpecificDetailSearchResult,
- eidData, pendingReq);
+ return registerSearchService.step7aKittProcess(registerData, countrySpecificDetailSearchResult,
+ eidasData, pendingReq);
}
- private String step8RegisterSearchWithMds(ExecutionContext executionContext, SimpleEidasData eidData) {
+ private String step8RegisterSearchWithMds(ExecutionContext executionContext, SimpleEidasData eidasData) {
log.trace("Starting step8RegisterSearchWithMds");
- MergedRegisterSearchResult mdsSearchResult = registerSearchService.searchWithMds(eidData);
- if (mdsSearchResult.getResultCount() == 0) {
- executionContext.put(TRANSITION_TO_CREATE_NEW_ERNB_ENTRY_TASK, true);
+ MergedRegisterSearchResult registerData = registerSearchService.searchWithMds(eidasData);
+ if (registerData.getResultCount() == 0) {
+ executionContext.put(TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK, true);
} else {
executionContext.put(TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK, true);
}
// todo das suchergebnis auch noch speichern für später!
//TODO implement next phase and return correct value
+ // TODO what to return?
return null;
}
@@ -207,30 +209,26 @@ public class InitialSearchTask extends AbstractAuthServletTask {
throws EidasAttributeException {
final ILightResponse eidasResponse = authProcessData
.getGenericDataFromSession(DATA_FULL_EIDAS_RESPONSE, ILightResponse.class);
- return convertSimpleMapToSimpleData(convertEidasAttrToSimpleMap(eidasResponse.getAttributes().getAttributeMap()));
+ Map<String, Object> simpleMap = convertEidasAttrToSimpleMap(eidasResponse.getAttributes().getAttributeMap());
+ return convertSimpleMapToSimpleData(simpleMap);
}
private SimpleEidasData convertSimpleMapToSimpleData(Map<String, Object> eidasAttrMap)
throws EidasAttributeException {
SimpleEidasData result = new SimpleEidasData();
-
result.setCitizenCountryCode(processCountryCode(eidasAttrMap.get(eIDAS_ATTR_PERSONALIDENTIFIER)));
-
// MDS attributes
result.setPseudonym(processPseudonym(eidasAttrMap.get(eIDAS_ATTR_PERSONALIDENTIFIER)));
result.setFamilyName(processFamilyName(eidasAttrMap.get(eIDAS_ATTR_CURRENTFAMILYNAME)));
result.setGivenName(processGivenName(eidasAttrMap.get(eIDAS_ATTR_CURRENTGIVENNAME)));
result.setDateOfBirth(processDateOfBirthToString(eidasAttrMap.get(eIDAS_ATTR_DATEOFBIRTH)));
-
// additional attributes
result.setPlaceOfBirth(processPlaceOfBirth(eidasAttrMap.get(eIDAS_ATTR_PLACEOFBIRTH)));
result.setBirthName(processBirthName(eidasAttrMap.get(eIDAS_ATTR_BIRTHNAME)));
result.setAddress(processAddress(eidasAttrMap.get(eIDAS_ATTR_CURRENTADDRESS)));
-
if (eidasAttrMap.containsKey(eIDAS_ATTR_TAXREFERENCE)) {
result.setTaxNumber(processTaxReference(eidasAttrMap.get(eIDAS_ATTR_TAXREFERENCE)));
}
-
//TODO other additional attributes
return result;
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAustrianResidenceGuiResponseTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAustrianResidenceGuiResponseTask.java
index 2020274a..7dcf62ac 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAustrianResidenceGuiResponseTask.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAustrianResidenceGuiResponseTask.java
@@ -104,7 +104,7 @@ public class ReceiveAustrianResidenceGuiResponseTask extends AbstractAuthServlet
step18_RegisterSearch(street, city, zipcode);//TODO also MDS?
} else {
//step 20 or for now (phase 1) step 9
- executionContext.put(Constants.TRANSITION_TO_CREATE_NEW_ERNB_ENTRY_TASK, true);
+ executionContext.put(Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK, true);
}