aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas <>2022-07-01 16:41:00 +0200
committerThomas <>2022-07-01 16:41:00 +0200
commite3afbc7442ad3893e7615d50747c03f600eb1a1b (patch)
tree88a823f7d342317f94f9a89ae3865ef3ace53d40
parentf2a32b225c243e2cf8b5b368cc6ac4611ce3a476 (diff)
downloadNational_eIDAS_Gateway-e3afbc7442ad3893e7615d50747c03f600eb1a1b.tar.gz
National_eIDAS_Gateway-e3afbc7442ad3893e7615d50747c03f600eb1a1b.tar.bz2
National_eIDAS_Gateway-e3afbc7442ad3893e7615d50747c03f600eb1a1b.zip
feat(core): update statistic-logger to include matching results
-rw-r--r--basicConfig/templates/other_login_method.html2
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java2
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SelectedLoginMethod.java2
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/AlternativeSearchTask.java2
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateNewErnpEntryTask.java4
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java5
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAustrianResidenceGuiResponseTask.java5
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveMobilePhoneSignatureResponseTask.java2
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java16
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/MatchingTaskUtils.java22
-rw-r--r--modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java11
-rw-r--r--modules/core_common_lib/src/main/java/at/asitplus/eidas/specific/core/MsEidasNodeConstants.java14
-rw-r--r--modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/logger/StatisticLogger.java18
13 files changed, 91 insertions, 14 deletions
diff --git a/basicConfig/templates/other_login_method.html b/basicConfig/templates/other_login_method.html
index c5bc9668..31ff74a6 100644
--- a/basicConfig/templates/other_login_method.html
+++ b/basicConfig/templates/other_login_method.html
@@ -150,7 +150,7 @@
<!-- Abbrechen Button -->
<form class="block,singleButton" method="post" action="$contextPath$submitEndpoint" th:attr="action=@{${submitEndpoint}}">
<button type="submit" value="Abbrechen/Cancel" th:text="#{gui.otherlogin.cancel}"></button>
- <input type="hidden" name="stopAuthProcess" value="true">
+ <input type="hidden" name="STOP_MATCHING_PROCESS" value="true">
<input type="hidden" name="pendingid" value="$pendingid" th:attr="value=${pendingid}">
</form>
</div>
diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java
index ce1d2a11..66848fcc 100644
--- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java
+++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/Constants.java
@@ -128,7 +128,7 @@ public class Constants {
public static final String CONIG_PROPS_EIDAS_COMMON_CLIENT_SSL_TRUSTSTORE_NAME = CONIG_PROPS_EIDAS_COMMON_CLIENT
+ ".ssl.trustStore.name";
- /** Enable / Disable matching based on address search **/
+ /** Enable / Disable matching based on address search. **/
public static final String CONFIG_PROP_MATCHING_BY_ADDRESS = CONIG_PROPS_EIDAS_PREFIX + ".matching.byaddress.enable";
public static final String CONFIG_PROP_MATCHING_BY_ADDRESS_MAX_RESULTS =
diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SelectedLoginMethod.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SelectedLoginMethod.java
index 993c0924..c8a2da88 100644
--- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SelectedLoginMethod.java
+++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SelectedLoginMethod.java
@@ -1,5 +1,5 @@
package at.asitplus.eidas.specific.modules.auth.eidas.v2.dao;
public enum SelectedLoginMethod {
- EIDAS_LOGIN, MOBILE_PHONE_SIGNATURE_LOGIN, NO_OTHER_LOGIN, ADD_ME_AS_NEW, REQUESTING_NEW_ENTRY
+ EIDAS_LOGIN, MOBILE_PHONE_SIGNATURE_LOGIN, NO_OTHER_LOGIN, ADD_ME_AS_NEW, REQUESTING_NEW_ENTRY, STOP_MATCHING_PROCESS
}
diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/AlternativeSearchTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/AlternativeSearchTask.java
index e8fb5b6b..ccc84f46 100644
--- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/AlternativeSearchTask.java
+++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/AlternativeSearchTask.java
@@ -36,6 +36,7 @@ import javax.servlet.http.HttpServletResponse;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Component;
+import at.asitplus.eidas.specific.core.MsEidasNodeConstants.MATCHING_STATES;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.MatchedPersonResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
@@ -243,6 +244,7 @@ public class AlternativeSearchTask extends AbstractAuthServletTask {
throws WorkflowException, EaafStorageException {
MatchedPersonResult result = MatchedPersonResult.generateFormMatchingResult(
searchResult.getResult(), eidasData.getCitizenCountryCode());
+ MatchingTaskUtils.setMatchingState(pendingReq, MATCHING_STATES.BY_EIDAS);
MatchingTaskUtils.storeFinalMatchingResult(pendingReq, result);
//remove intermediate matching-state
diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateNewErnpEntryTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateNewErnpEntryTask.java
index c7843be5..6680650e 100644
--- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateNewErnpEntryTask.java
+++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateNewErnpEntryTask.java
@@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import at.asitplus.eidas.specific.core.MsEidasNodeConstants.MATCHING_STATES;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.ernp.ErnpRestClient;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.ernp.ErnpRestClient.ErnpRegisterResult;
@@ -91,7 +92,8 @@ public class CreateNewErnpEntryTask extends AbstractAuthServletTask {
}
// finish matching process, because new user-entry uniquly matches
- log.info("User successfully registerred into ERnP and matching tasks are finished ");
+ log.info("User successfully registerred into ERnP and matching tasks are finished ");
+ MatchingTaskUtils.setMatchingState(pendingReq, MATCHING_STATES.BY_NEW_ERNP_ENTRY);
MatchingTaskUtils.storeFinalMatchingResult(pendingReq,
MatchedPersonResult.generateFormMatchingResult(
resp.getPersonResult().get(0), simpleEidasData.getCitizenCountryCode()));
diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java
index 3a775837..86d279c6 100644
--- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java
+++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java
@@ -34,6 +34,7 @@ import javax.servlet.http.HttpServletResponse;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Component;
+import at.asitplus.eidas.specific.core.MsEidasNodeConstants.MATCHING_STATES;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.MatchedPersonResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
@@ -123,7 +124,8 @@ public class InitialSearchTask extends AbstractAuthServletTask {
step6CountrySpecificSearch(executionContext, searchResult.getOperationStatus(), eidasData);
} else if (resultCount == 1) {
- RegisterResult updatedResult = step3CheckRegisterUpdateNecessary(searchResult, eidasData);
+ RegisterResult updatedResult = step3CheckRegisterUpdateNecessary(searchResult, eidasData);
+ MatchingTaskUtils.setMatchingState(pendingReq, MATCHING_STATES.BY_PERSONALID);
foundMatchFinalizeTask(updatedResult, eidasData);
} else {
@@ -151,6 +153,7 @@ public class InitialSearchTask extends AbstractAuthServletTask {
} else if (searchResult.getResultCount() == 1) {
log.trace("'step6CountrySpecificSearch' finds a person. Forward to 'step7aKittProcess' step ... ");
RegisterStatusResults updatedResult = registerSearchService.step7aKittProcess(searchResult, eidasData);
+ MatchingTaskUtils.setMatchingState(pendingReq, MATCHING_STATES.BY_COUNTRY_SPECIFIC);
foundMatchFinalizeTask(updatedResult.getResult(), eidasData);
} else {
diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAustrianResidenceGuiResponseTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAustrianResidenceGuiResponseTask.java
index f335bc2a..00a7e28d 100644
--- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAustrianResidenceGuiResponseTask.java
+++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAustrianResidenceGuiResponseTask.java
@@ -41,6 +41,7 @@ import org.springframework.stereotype.Component;
import com.google.common.collect.Sets;
+import at.asitplus.eidas.specific.core.MsEidasNodeConstants.MATCHING_STATES;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.controller.AdresssucheController;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.controller.AdresssucheController.AdresssucheOutput;
@@ -185,7 +186,8 @@ public class ReceiveAustrianResidenceGuiResponseTask extends AbstractLocaleAuthS
// update register information
RegisterStatusResults updateResult = registerSearchService.step7aKittProcess(residencyResult, eidasData);
- // store updated result to re-used in CreateIdentityLink step, because there we need bPK and MDS
+ // store updated result to re-used in CreateIdentityLink step, because there we need bPK and MDS
+ MatchingTaskUtils.setMatchingState(pendingReq, MATCHING_STATES.BY_ADDRESS);
MatchingTaskUtils.storeFinalMatchingResult(pendingReq,
MatchedPersonResult.generateFormMatchingResult(
updateResult.getResult(), eidasData.getCitizenCountryCode()));
@@ -193,6 +195,7 @@ public class ReceiveAustrianResidenceGuiResponseTask extends AbstractLocaleAuthS
} else {
log.warn("Suspect state FOUND. Matching by residence was neccessary but NO register-update are required!");
// no update required. Data can be used as it is.
+ MatchingTaskUtils.setMatchingState(pendingReq, MATCHING_STATES.BY_ADDRESS);
MatchingTaskUtils.storeFinalMatchingResult(pendingReq,
MatchedPersonResult.generateFormMatchingResult(
residencyResult.getResult(), eidasData.getCitizenCountryCode()));
diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveMobilePhoneSignatureResponseTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveMobilePhoneSignatureResponseTask.java
index b212d133..11ac9549 100644
--- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveMobilePhoneSignatureResponseTask.java
+++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveMobilePhoneSignatureResponseTask.java
@@ -47,6 +47,7 @@ import org.opensaml.saml.saml2.core.StatusCode;
import org.opensaml.saml.saml2.metadata.IDPSSODescriptor;
import org.springframework.stereotype.Component;
+import at.asitplus.eidas.specific.core.MsEidasNodeConstants.MATCHING_STATES;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.MatchedPersonResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
@@ -204,6 +205,7 @@ public class ReceiveMobilePhoneSignatureResponseTask extends AbstractAuthServlet
registerSearchService.step7aKittProcess(registerResult, eidasData);
// store search result to re-used in CreateIdentityLink step, because there we need bPK and MDS
+ MatchingTaskUtils.setMatchingState(pendingReq, MATCHING_STATES.BY_ID_AUSTRIA);
MatchingTaskUtils.storeFinalMatchingResult(pendingReq,
MatchedPersonResult.generateFormMatchingResult(registerResult.getResult(),
eidasData.getCitizenCountryCode()));
diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java
index 3fc29c4e..159b5b51 100644
--- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java
+++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java
@@ -34,8 +34,10 @@ import org.springframework.stereotype.Component;
import com.google.common.collect.Sets;
+import at.asitplus.eidas.specific.core.MsEidasNodeConstants.MATCHING_STATES;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SelectedLoginMethod;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.MatchingTaskUtils;
import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
import at.gv.egiz.eaaf.core.exceptions.EaafException;
import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
@@ -81,8 +83,8 @@ public class ReceiveOtherLoginMethodGuiResponseTask extends AbstractLocaleAuthSe
executionContext.put(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK, false);
executionContext.put(Constants.REQ_SELECTED_LOGIN_METHOD_PARAMETER, selection.name());
executionContext.remove(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED);
- executionContext.remove(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON);
- transitionToNextTask(executionContext, selection);
+ executionContext.remove(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON);
+ transitionToNextTask(executionContext, selection, request, response);
} catch (TaskExecutionException e) {
throw e;
@@ -105,9 +107,15 @@ public class ReceiveOtherLoginMethodGuiResponseTask extends AbstractLocaleAuthSe
return null;
}
- private void transitionToNextTask(ExecutionContext executionContext, SelectedLoginMethod selection)
- throws TaskExecutionException {
+ private void transitionToNextTask(ExecutionContext executionContext, SelectedLoginMethod selection,
+ HttpServletRequest request, HttpServletResponse response) throws TaskExecutionException {
switch (selection) {
+ case STOP_MATCHING_PROCESS:
+ log.info("Matching process WAS stopped by entity. Stopping auth. process ... ");
+ MatchingTaskUtils.setMatchingState(pendingReq, MATCHING_STATES.CANCELED_BY_USER);
+ stopProcessFromUserDecision(executionContext, request, response);
+ return;
+
case EIDAS_LOGIN:
executionContext.put(Constants.TRANSITION_TO_GENERATE_EIDAS_LOGIN, true);
return;
diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/MatchingTaskUtils.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/MatchingTaskUtils.java
index c8a1f190..8ecefe49 100644
--- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/MatchingTaskUtils.java
+++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/utils/MatchingTaskUtils.java
@@ -15,6 +15,8 @@ import org.springframework.lang.NonNull;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
+import at.asitplus.eidas.specific.core.MsEidasNodeConstants;
+import at.asitplus.eidas.specific.core.MsEidasNodeConstants.MATCHING_STATES;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.MatchedPersonResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
@@ -27,7 +29,9 @@ import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper;
import eu.eidas.auth.commons.attribute.AttributeDefinition;
import eu.eidas.auth.commons.attribute.AttributeValue;
import eu.eidas.auth.commons.protocol.eidas.impl.PostalAddress;
+import lombok.extern.slf4j.Slf4j;
+@Slf4j
public class MatchingTaskUtils {
/**
@@ -105,7 +109,6 @@ public class MatchingTaskUtils {
* @param personInfos Person information after a successful match
* @throws EaafStorageException In case of data can not be add into session
*/
- @Nullable
public static void storeFinalMatchingResult(IRequest pendingReq, MatchedPersonResult personInfos)
throws EaafStorageException {
getAuthProcessDataWrapper(pendingReq).setGenericDataToSession(
@@ -114,6 +117,23 @@ public class MatchingTaskUtils {
}
/**
+ * Store matching result-state.
+ *
+ * @param pendingReq Current pendingRequest
+ * @param state Operation that results into a person match
+ */
+ public static void setMatchingState(IRequest pendingReq, MATCHING_STATES state) {
+ try {
+ pendingReq.setRawDataToTransaction(MsEidasNodeConstants.DATA_MATCHING_STATE, state);
+
+ } catch (EaafStorageException e) {
+ log.warn("Can NOT set matching-state for statistic logging.", e);
+
+ }
+ }
+
+
+ /**
* Get holder for authentication information for the current process.
*
* @param pendingReq Current pendingRequest
diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java
index af7bf0bf..66867fce 100644
--- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java
+++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java
@@ -5,6 +5,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.assertTrue;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Before;
@@ -79,6 +80,16 @@ public class ReceiveOtherLoginMethodGuiResponseTaskTest {
}
@Test
+ public void withStopMatchingSelection() throws TaskExecutionException {
+httpReq.setParameter(Constants.REQ_SELECTED_LOGIN_METHOD_PARAMETER, SelectedLoginMethod.STOP_MATCHING_PROCESS.name());
+
+ task.execute(pendingReq, executionContext);
+
+ assertTrue("stoppedByUser", pendingReq.isAbortedByUser());
+
+ }
+
+ @Test
public void withMobileSignatureSelection() throws TaskExecutionException {
testTransition(SelectedLoginMethod.MOBILE_PHONE_SIGNATURE_LOGIN, Constants.TRANSITION_TO_GENERATE_MOBILE_PHONE_SIGNATURE_REQUEST_TASK);
assertEquals("return to selection", false, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
diff --git a/modules/core_common_lib/src/main/java/at/asitplus/eidas/specific/core/MsEidasNodeConstants.java b/modules/core_common_lib/src/main/java/at/asitplus/eidas/specific/core/MsEidasNodeConstants.java
index be5d7c7d..eb7c90f2 100644
--- a/modules/core_common_lib/src/main/java/at/asitplus/eidas/specific/core/MsEidasNodeConstants.java
+++ b/modules/core_common_lib/src/main/java/at/asitplus/eidas/specific/core/MsEidasNodeConstants.java
@@ -184,6 +184,9 @@ public class MsEidasNodeConstants {
public static final String DATA_REQUESTED_LOA_LIST = "req_requestedLoA";
public static final String DATA_REQUESTED_LOA_COMPERISON = "req_requestedLoAComperision";
+
+ public static final String DATA_MATCHING_STATE = "process_matchingstate";
+
public static final List<String> COUNTRY_SELECTION_PARAM_WHITELIST =
Arrays.asList(REQ_PARAM_SELECTED_COUNTRY, REQ_PARAM_SELECTED_ENVIRONMENT);
@@ -235,6 +238,17 @@ public class MsEidasNodeConstants {
});
+ public enum MATCHING_STATES {
+ NO_REQUIRED,
+ CANCELED_BY_USER,
+ BY_PERSONALID,
+ BY_COUNTRY_SPECIFIC,
+ BY_ID_AUSTRIA,
+ BY_EIDAS,
+ BY_ADDRESS,
+ BY_NEW_ERNP_ENTRY
+ };
+
private MsEidasNodeConstants() {
//hidden Constructor for class with static values only.
}
diff --git a/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/logger/StatisticLogger.java b/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/logger/StatisticLogger.java
index bdaf83f6..c2c8d368 100644
--- a/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/logger/StatisticLogger.java
+++ b/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/logger/StatisticLogger.java
@@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory;
import at.asitplus.eidas.specific.core.MsEidasNodeConstants;
import at.gv.egiz.eaaf.core.api.IRequest;
+import at.gv.egiz.eaaf.core.api.IStatusMessenger;
import at.gv.egiz.eaaf.core.api.idp.IAuthData;
import at.gv.egiz.eaaf.core.api.logging.IStatisticLogger;
import at.gv.egiz.eaaf.core.exceptions.EaafException;
@@ -50,6 +51,7 @@ public class StatisticLogger implements IStatisticLogger {
protocolRequest.getRawData(MsEidasNodeConstants.DATA_REQUESTERID),
protocolRequest.getServiceProviderConfiguration().getAreaSpecificTargetIdentifier(),
authData.getCiticenCountryCode(),
+ extractMatchingState(protocolRequest.getRawData(MsEidasNodeConstants.DATA_MATCHING_STATE)),
STATUS_SUCCESS,
StringUtils.EMPTY,
StringUtils.EMPTY));
@@ -58,7 +60,7 @@ public class StatisticLogger implements IStatisticLogger {
@Override
public void logErrorOperation(Throwable throwable) {
- String errorId = "TODO";
+ String errorId = IStatusMessenger.CODES_INTERNAL_ERROR_GENERIC;
if (throwable instanceof EaafException) {
errorId = ((EaafException) throwable).getErrorId();
}
@@ -69,6 +71,7 @@ public class StatisticLogger implements IStatisticLogger {
StringUtils.EMPTY,
StringUtils.EMPTY,
StringUtils.EMPTY,
+ StringUtils.EMPTY,
STATUS_ERROR,
errorId,
throwable.getMessage()));
@@ -89,6 +92,7 @@ public class StatisticLogger implements IStatisticLogger {
errorRequest.getRawData(MsEidasNodeConstants.DATA_REQUESTERID),
errorRequest.getServiceProviderConfiguration().getAreaSpecificTargetIdentifier(),
StringUtils.EMPTY,
+ extractMatchingState(errorRequest.getRawData(MsEidasNodeConstants.DATA_MATCHING_STATE)),
STATUS_ERROR,
errorId,
throwable.getMessage()));
@@ -99,6 +103,7 @@ public class StatisticLogger implements IStatisticLogger {
StringUtils.EMPTY,
StringUtils.EMPTY,
StringUtils.EMPTY,
+ StringUtils.EMPTY,
STATUS_ERROR,
errorId,
throwable.getMessage()));
@@ -112,8 +117,13 @@ public class StatisticLogger implements IStatisticLogger {
}
+ private String extractMatchingState(Object state) {
+ return state != null ? state.toString() : MsEidasNodeConstants.MATCHING_STATES.NO_REQUIRED.toString();
+
+ }
+
private String buildLogMessage(String transId, String entityId, Object requesterId, String target,
- String cc,
+ String cc, String matchingState,
String status, String errorCode, String errorMsg) {
String logMsg = StringUtils.EMPTY;
@@ -131,7 +141,9 @@ public class StatisticLogger implements IStatisticLogger {
logMsg += target + ",";
logMsg += cc + ",";
-
+
+ logMsg += matchingState + ",";
+
logMsg += status + ",";
logMsg += errorCode + ",";
logMsg += errorMsg;