From f02787f6186169aef9e5fc131b4c82cded1b615a Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Tue, 16 Nov 2021 15:02:30 +0100 Subject: update 'advanced matching steps' tasks to optimize user handling between 'ID Austria Login', 'alternative eIDAS Login', and 'address search' --- basicConfig/properties/messages.properties | 4 ++ basicConfig/properties/messages_de.properties | 11 +++++ basicConfig/templates/other_login_method.html | 10 ++++ .../GenerateCountrySelectionFrameTaskTest.java | 1 + eidas_modules/authmodule-eIDAS-v2/pom.xml | 1 + .../specific/modules/auth/eidas/v2/Constants.java | 9 ++++ .../auth/eidas/v2/dao/SelectedLoginMethod.java | 2 +- .../v2/tasks/GenerateOtherLoginMethodGuiTask.java | 21 ++++++++- .../ReceiveOtherLoginMethodGuiResponseTask.java | 5 ++ .../resources/eIDAS.Authentication.process.xml | 23 +++++++--- .../tasks/GenerateOtherLoginMethodGuiTaskTest.java | 53 +++++++++++++++++++++- ...ReceiveOtherLoginMethodGuiResponseTaskTest.java | 31 +++++++++---- 12 files changed, 152 insertions(+), 19 deletions(-) diff --git a/basicConfig/properties/messages.properties b/basicConfig/properties/messages.properties index 3ea204dd..eae15865 100644 --- a/basicConfig/properties/messages.properties +++ b/basicConfig/properties/messages.properties @@ -36,6 +36,10 @@ gui.matching.otherloginmethod.info.text=Your login information could not be clea gui.matching.otherloginmethod.ida=You have an ID Austria gui.matching.otherloginmethod.eidas=You can provide additional information via eIDAS gui.matching.otherloginmethod.residence=Have you ever lived in Austria? +gui.matching.otherloginmethod.addmeasnew=Add me as new entity in Austrian eID system + +gui.matching.otherloginmethod.error.title=Matching of further information failed: +gui.matching.otherloginmethod.error.msg=No identity match with additional information. Use another option or provide more information. gui.countryselection.country.be=Belgium diff --git a/basicConfig/properties/messages_de.properties b/basicConfig/properties/messages_de.properties index 41ef2551..a35b9d2c 100644 --- a/basicConfig/properties/messages_de.properties +++ b/basicConfig/properties/messages_de.properties @@ -32,6 +32,17 @@ gui.countryselection.infos.general.part.5=Nachdem Sie auf dieser Seite einen Mit gui.countryselection.infos.general.part.6=eingetragen. Damit wird sichergestellt, dass Sie auch im Rahmen zukünftiger Anmeldeprozesse zu österreichischen Online-Anwendungen erfolgreich und eindeutig identifiziert werden können. +gui.matching.otherloginmethod.header=Assignment of your login information +gui.matching.otherloginmethod.info.text=Ihre Identität konnte nicht eindeutig in das österreichische eID System integriert werden. Für eine eindeutige Integration werden weitere Informationen benötigt. +gui.matching.otherloginmethod.ida=Sie besitzen einen ID Austria +gui.matching.otherloginmethod.eidas=Sie können weitere Attribute via eIDAS bereitstellen +gui.matching.otherloginmethod.residence=Sie haben bereits einmal in Österreichg gelebt? +gui.matching.otherloginmethod.addmeasnew=Neuregistrierung im österreichischen eID System + +gui.matching.otherloginmethod.error.title=Erweitertes Personenmatching fehlgeschlagen: +gui.matching.otherloginmethod.error.msg=Ihre Identität konnte nicht eindeutig zugeordnet werden. Wählen Sie eine andere Option oder stellen zusätzliche Informationen bereit. + + gui.countryselection.country.be=Belgien gui.countryselection.country.be.logo.alt=Belgische-eID gui.countryselection.country.hr=Kroatien diff --git a/basicConfig/templates/other_login_method.html b/basicConfig/templates/other_login_method.html index 035c359f..fffe3930 100644 --- a/basicConfig/templates/other_login_method.html +++ b/basicConfig/templates/other_login_method.html @@ -160,6 +160,10 @@ form { Für eine eindeutig Integration sind weitere Informationen erforderlich.

+
+ Info

+
+
@@ -178,6 +182,12 @@ form {
+ +
+ + + +
diff --git a/connector/src/test/java/at/asitplus/eidas/specific/connector/test/task/GenerateCountrySelectionFrameTaskTest.java b/connector/src/test/java/at/asitplus/eidas/specific/connector/test/task/GenerateCountrySelectionFrameTaskTest.java index d902f758..49d7acf4 100644 --- a/connector/src/test/java/at/asitplus/eidas/specific/connector/test/task/GenerateCountrySelectionFrameTaskTest.java +++ b/connector/src/test/java/at/asitplus/eidas/specific/connector/test/task/GenerateCountrySelectionFrameTaskTest.java @@ -52,6 +52,7 @@ public class GenerateCountrySelectionFrameTaskTest { public static void classInitializer() { final String current = new java.io.File(".").toURI().toString(); System.setProperty("eidas.ms.configuration", current + "src/test/resources/config/junit_config_1.properties"); + Locale.setDefault(Locale.ENGLISH); } diff --git a/eidas_modules/authmodule-eIDAS-v2/pom.xml b/eidas_modules/authmodule-eIDAS-v2/pom.xml index a695d21a..6b5469a1 100644 --- a/eidas_modules/authmodule-eIDAS-v2/pom.xml +++ b/eidas_modules/authmodule-eIDAS-v2/pom.xml @@ -341,6 +341,7 @@ **/org/w3/_2001/_04/* **/szrservices/* **/generated/cxf/* + **at/gv/bmi/namespace/* 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 5dfc9e68..ee9b00f7 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 @@ -279,6 +279,14 @@ public class Constants { public static final String COUNTRY_CODE_DE = "DE"; public static final String COUNTRY_CODE_IT = "IT"; + + // UI options + public static final String HTML_FORM_ADVANCED_MATCHING_FAILED = "advancedMatchingFailed"; + + + // ProcessEngine context + public static final String CONTEXT_FLAG_ADVANCED_MATCHING_FAILED = HTML_FORM_ADVANCED_MATCHING_FAILED; + /** * {@link at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.CreateNewErnpEntryTask}. */ @@ -307,6 +315,7 @@ public class Constants { */ public static final String TRANSITION_TO_GENERATE_EIDAS_LOGIN = "TASK_GenerateAlternativeEidasAuthn"; + /** * Stores login selection from user. */ diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SelectedLoginMethod.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SelectedLoginMethod.java index f8e2ff2e..70904e4f 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SelectedLoginMethod.java +++ b/eidas_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 + EIDAS_LOGIN, MOBILE_PHONE_SIGNATURE_LOGIN, NO_OTHER_LOGIN, ADD_ME_AS_NEW } diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java index dbdda78e..7107709f 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java @@ -23,6 +23,8 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks; +import java.io.Serializable; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -31,11 +33,12 @@ import org.springframework.stereotype.Component; import at.asitplus.eidas.specific.connector.MsEidasNodeConstants; import at.asitplus.eidas.specific.connector.gui.StaticGuiBuilderConfiguration; -import at.gv.egiz.eaaf.core.api.gui.IGuiBuilderConfiguration; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants; import at.gv.egiz.eaaf.core.api.gui.ISpringMvcGuiFormBuilder; import at.gv.egiz.eaaf.core.api.idp.IConfiguration; import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException; +import at.gv.egiz.eaaf.core.impl.gui.AbstractGuiFormBuilderConfiguration; import at.gv.egiz.eaaf.core.impl.idp.auth.modules.AbstractAuthServletTask; import lombok.extern.slf4j.Slf4j; @@ -62,7 +65,7 @@ public class GenerateOtherLoginMethodGuiTask extends AbstractAuthServletTask { public void execute(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) throws TaskExecutionException { try { - final IGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( + final StaticGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( basicConfig, pendingReq, basicConfig.getBasicConfiguration( @@ -71,6 +74,13 @@ public class GenerateOtherLoginMethodGuiTask extends AbstractAuthServletTask { MsEidasNodeConstants.ENDPOINT_OTHER_LOGIN_METHOD_SELECTION, resourceLoader); + // inject flag to indicate advanced matching error + if (getExecutionContextFlag(executionContext, Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED)) { + config.putCustomParameter(AbstractGuiFormBuilderConfiguration.PARAM_GROUP_UIOPTIONS, + Constants.HTML_FORM_ADVANCED_MATCHING_FAILED, String.valueOf(true)); + + } + guiBuilder.build(request, response, config, "Other login methods selection form"); } catch (final Exception e) { @@ -79,4 +89,11 @@ public class GenerateOtherLoginMethodGuiTask extends AbstractAuthServletTask { } } + private boolean getExecutionContextFlag(ExecutionContext executionContext, String key) { + Serializable value = executionContext.get(key); + return value instanceof Boolean && (boolean)value + || value instanceof String && Boolean.parseBoolean((String) value); + + } + } diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java index 8431d968..c2c1a351 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java @@ -70,6 +70,7 @@ public class ReceiveOtherLoginMethodGuiResponseTask extends AbstractLocaleAuthSe try { SelectedLoginMethod selection = SelectedLoginMethod.valueOf(extractUserSelection(request)); executionContext.put(Constants.REQ_SELECTED_LOGIN_METHOD_PARAMETER, selection); + executionContext.remove(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED); transitionToNextTask(executionContext, selection); } catch (final IllegalArgumentException e) { @@ -113,6 +114,10 @@ public class ReceiveOtherLoginMethodGuiResponseTask extends AbstractLocaleAuthSe executionContext.put(Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK, true); return; + case ADD_ME_AS_NEW: + executionContext.put(Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK, true); + return; + default: throw new InvalidUserInputException("module.eidasauth.matching.98"); diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml b/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml index 59aef423..c9bdad94 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml @@ -33,6 +33,7 @@ from="initialRegisterSearch" to="generateOtherLoginMethodGuiTask"/> + @@ -40,25 +41,35 @@ from="receiveOtherLoginMethodGuiResponseTask" to="generateMobilePhoneSignatureRequestTask" /> + + - + + from="alternativeRegisterSearch" to="generateOtherLoginMethodGuiTask" /> + + + from="receiveMobilePhoneSignatureResponseTask" to="generateOtherLoginMethodGuiTask" /> - + + + + + from="receiveAustrianResidenceGuiResponseTask" to="createNewErnpEntryTask" /> + - + diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java index eed0d53d..7c4f8a41 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java @@ -1,5 +1,8 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.test.tasks; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + import java.io.UnsupportedEncodingException; import java.text.MessageFormat; import java.util.Locale; @@ -20,11 +23,17 @@ import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.json.JsonMapper; + +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.tasks.GenerateOtherLoginMethodGuiTask; import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException; import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl; import at.gv.egiz.eaaf.core.impl.idp.process.ExecutionContextImpl; +import lombok.SneakyThrows; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { @@ -38,6 +47,8 @@ public class GenerateOtherLoginMethodGuiTaskTest { private static final String TEST_PATTER_REQ_PARAM = ""; + private static ObjectMapper mapper = new ObjectMapper(); + @Autowired GenerateOtherLoginMethodGuiTask task; private ExecutionContextImpl executionContext = new ExecutionContextImpl(); @@ -69,9 +80,47 @@ public class GenerateOtherLoginMethodGuiTaskTest { LocaleContextHolder.resetLocaleContext(); } + @Test - public void validHtmlResponseWithOutLocale() throws TaskExecutionException, UnsupportedEncodingException { + @SneakyThrows + public void jsonResponse() throws TaskExecutionException, UnsupportedEncodingException { + + executionContext.put(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true); + httpReq.addHeader("Accept", "application/json"); + + task.execute(pendingReq, executionContext); + + //result validation + Assert.assertEquals("httpStausCode", 200, httpResp.getStatus()); + Assert.assertEquals("http ContentType", "application/json;charset=UTF-8", httpResp.getContentType()); + final String content = httpResp.getContentAsString(); + assertNotNull("response body is null", content); + Assert.assertFalse("response body is empty", content.isEmpty()); + final JsonNode json = new JsonMapper().readTree(content); + assertNotNull("response body is null", json); + assertNotNull("advancedMatchFailed", json.get(Constants.HTML_FORM_ADVANCED_MATCHING_FAILED)); + assertTrue("advancedMatchFailed", json.get(Constants.HTML_FORM_ADVANCED_MATCHING_FAILED).asBoolean()); + + } + + @Test + public void advancedMatchingFailedMsg() throws TaskExecutionException, UnsupportedEncodingException { + + executionContext.put(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true); + + task.execute(pendingReq, executionContext); + + //result validation + String html = doBasicValidation(); + Assert.assertTrue("No english text", + html.contains("Matching of further information failed")); + + } + + @Test + public void validHtmlResponseWithOutLocale() throws TaskExecutionException, UnsupportedEncodingException { + task.execute(pendingReq, executionContext); //result validation @@ -79,6 +128,8 @@ public class GenerateOtherLoginMethodGuiTaskTest { Assert.assertTrue("No english text", html.contains("Information on Logins with European eIDs")); + Assert.assertFalse("No english text", + html.contains("Matching of further information failed")); } diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java index c6b2e1fe..84e78fdb 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java @@ -1,12 +1,12 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.test.tasks; -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.exception.InvalidUserInputException; -import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.ReceiveOtherLoginMethodGuiResponseTask; -import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException; -import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl; -import at.gv.egiz.eaaf.core.impl.idp.process.ExecutionContextImpl; +import static org.junit.Assert.assertEquals; +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.springframework.util.Assert.isInstanceOf; + import org.apache.commons.lang3.RandomStringUtils; import org.junit.Before; import org.junit.BeforeClass; @@ -23,8 +23,13 @@ import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; -import static org.junit.Assert.*; -import static org.springframework.util.Assert.isInstanceOf; +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.exception.InvalidUserInputException; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.ReceiveOtherLoginMethodGuiResponseTask; +import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException; +import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl; +import at.gv.egiz.eaaf.core.impl.idp.process.ExecutionContextImpl; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { @@ -83,9 +88,15 @@ public class ReceiveOtherLoginMethodGuiResponseTaskTest { public void withNoOtherLoginSelection() throws TaskExecutionException { testTransition(SelectedLoginMethod.NO_OTHER_LOGIN, Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK); } + + @Test + public void withAddMeAsNewSelection() throws TaskExecutionException { + testTransition(SelectedLoginMethod.ADD_ME_AS_NEW, Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK); + } public void testTransition(SelectedLoginMethod loginMethod, String expectedTransition) throws TaskExecutionException { httpReq.setParameter(Constants.REQ_SELECTED_LOGIN_METHOD_PARAMETER, loginMethod.name()); + executionContext.put(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true); task.execute(pendingReq, executionContext); @@ -94,6 +105,8 @@ public class ReceiveOtherLoginMethodGuiResponseTaskTest { assertNotNull("no login-selection found", executionContext.get(Constants.REQ_SELECTED_LOGIN_METHOD_PARAMETER)); assertEquals("Wrong login-selection found", loginMethod, executionContext.get(Constants.REQ_SELECTED_LOGIN_METHOD_PARAMETER)); assertEquals("Next task", true, executionContext.get(expectedTransition)); + assertNull("find advancedMatchingError flag", executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED)); + } public void withInvalidSelection() { -- cgit v1.2.3