From 71d94fdd4435187c13321322893cd9b1bf273402 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Tue, 8 Feb 2022 17:16:42 +0100 Subject: chore(matching): update 'other-login-method' GUI steps to use it as common starting-point for any other alternative matching method --- basicConfig/properties/messages.properties | 17 ++++- basicConfig/properties/messages_de.properties | 17 ++++- basicConfig/templates/other_login_method.html | 36 ++++++++-- .../specific/modules/auth/eidas/v2/Constants.java | 4 +- .../v2/tasks/GenerateOtherLoginMethodGuiTask.java | 7 ++ .../ReceiveOtherLoginMethodGuiResponseTask.java | 17 +++-- .../tasks/GenerateOtherLoginMethodGuiTaskTest.java | 76 +++++++++++++++------- 7 files changed, 134 insertions(+), 40 deletions(-) diff --git a/basicConfig/properties/messages.properties b/basicConfig/properties/messages.properties index 6674d0bd..fcb85bee 100644 --- a/basicConfig/properties/messages.properties +++ b/basicConfig/properties/messages.properties @@ -113,11 +113,22 @@ gui.countryselection.mode.dev=Development ##Other Login Methods page gui.otherlogin.title=eIDAS-Login Other Login Methods gui.otherlogin.header.selection=Select an alternative login method -gui.otherlogin.hs=Mobile Signature ("Handy-Signatur") -gui.otherlogin.eidas=Alternative eIDAS ID -gui.otherlogin.none=No alternative login methods +gui.otherlogin.button.hs=ID Austria +gui.otherlogin.button.eidas=Alternative eIDAS ID +gui.otherlogin.button.none=No alternative login methods +gui.otherlogin.button.inserternp=Use my eIDAS data to create a new Austrian identity gui.otherlogin.cancel=Cancel +gui.otherlogin.inserternp.infotext=You can create a new Austrian Identity by using your identity information provided by eIDAS. During these, you get a new Austrian identifier. + +module.eidasauth.matching.20=Matching be using residence information was canceled. Use another method for matching or create a new Austrian identity. +module.eidasauth.matching.21=Matching be using residence information failed by missing input information. Use another method for matching or create a new Austrian identity. +module.eidasauth.matching.22=Can not find an unique match by using residence information. Provide more or other data, use another method for matching, or create a new Austrian identity. +module.eidasauth.matching.23=Matching be using ID Austria was canceled. Use another method for matching or create a new Austrian identity. +module.eidasauth.matching.24=Matching be using ID Austria not possible. Use another method for matching or create a new Austrian identity. +module.eidasauth.matching.25=Matching be using alternative eIDAS authentication not possible. Provide more or other data, use another method for matching, or create a new Austrian identity. +module.eidasauth.matching.29=Matching be using other information failed. Provide more or other data, use another method for matching, or create a new Austrian identity. + ##Austrian Residency page gui.residency.title=Austrian Residency diff --git a/basicConfig/properties/messages_de.properties b/basicConfig/properties/messages_de.properties index 9c496903..613bead6 100644 --- a/basicConfig/properties/messages_de.properties +++ b/basicConfig/properties/messages_de.properties @@ -112,11 +112,22 @@ gui.countryselection.mode.dev=Development ##Other Login Methods page gui.otherlogin.title=eIDAS-Login Alternative Anmeldemethoden gui.otherlogin.header.selection=Wählen Sie eine alternative Anmeldemethode -gui.otherlogin.hs=Handy-Signatur -gui.otherlogin.eidas=Alternativer eIDAS Login -gui.otherlogin.none=Keine +gui.otherlogin.button.hs=Handy-Signatur +gui.otherlogin.button.eidas=Alternativer eIDAS Login +gui.otherlogin.button.none=Keine +gui.otherlogin.button.inserternp=Eine neue österreichische Identity auf Basis meiner eIDAS Daten erzeugen gui.otherlogin.cancel=Abbrechen +gui.otherlogin.inserternp.infotext=Falls Sie sich noch nie mit eIDAS in Österreich angemeldet haben und Sie auch noch keinen anderen Kontakt zur österreichischen Verwaltung hatten können Sie eine neue österreichischen Identifikatior erzeugen. + +module.eidasauth.matching.20=Matching auf Basis eine Wohnanschrift in Österreich wurde abgebrochen. Nutzen Sie eine andere Matchingmethode oder Erzeugen Sie einen neuen österreichischen Identifikator. +module.eidasauth.matching.21=Das Matching auf Basis eine Wohnanschrift in Österreich schlug fehl. Nutzen Sie eine andere Matchingmethode oder Erzeugen Sie einen neuen österreichischen Identifikator. +module.eidasauth.matching.22=Das Matching auf Basis eine Wohnanschrift in Österreich schlug fehl. Stellen Sie weitere Informationen bereit, nutzen Sie eine andere Matchingmethode oder Erzeugen Sie einen neuen österreichischen Identifikator. +module.eidasauth.matching.23=Matching auf Basis eines ID Autria wurde abgebrochen. Nutzen Sie eine andere Matchingmethode oder Erzeugen Sie einen neuen österreichischen Identifikator. +module.eidasauth.matching.24=Matching auf Basis eines ID Autria schlug fehl. Nutzen Sie eine andere Matchingmethode oder Erzeugen Sie einen neuen österreichischen Identifikator. +module.eidasauth.matching.25=Matching auf Basis einer alternativen eIDAS Anmeldung schlug fehl. Stellen Sie weitere Informationen bereit, nutzen Sie eine andere Matchingmethode oder Erzeugen Sie einen neuen österreichischen Identifikator. + + ##Austrian Residency page gui.residency.title=Österreichischer Wohnsitz gui.residency.header.selection=Suche nach Österreichischem Wohnsitz diff --git a/basicConfig/templates/other_login_method.html b/basicConfig/templates/other_login_method.html index 8f846f84..4fc061c0 100644 --- a/basicConfig/templates/other_login_method.html +++ b/basicConfig/templates/other_login_method.html @@ -49,29 +49,57 @@

Betrieben durch das Bundesministerium für Inneres

+
+

Detailed

+

Generell

+ + + +
+ +

Select an alternative login method

-
-
+ +
+ +

+ +
+ + + +
+
+
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 40bcd27a..e642c5ec 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 @@ -314,12 +314,14 @@ public class Constants { // UI options public static final String HTML_FORM_ADVANCED_MATCHING_FAILED = "advancedMatchingFailed"; + public static final String HTML_FORM_ADVANCED_MATCHING_FAILED_REASON = + HTML_FORM_ADVANCED_MATCHING_FAILED + "Reason"; // ProcessEngine context public static final String CONTEXT_FLAG_ADVANCED_MATCHING_FAILED = HTML_FORM_ADVANCED_MATCHING_FAILED; public static final String CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON = - HTML_FORM_ADVANCED_MATCHING_FAILED + "Reason"; + HTML_FORM_ADVANCED_MATCHING_FAILED_REASON; /** * {@link at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.CreateNewErnpEntryTask}. 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 7107709f..d29519be 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 @@ -79,6 +79,13 @@ public class GenerateOtherLoginMethodGuiTask extends AbstractAuthServletTask { config.putCustomParameter(AbstractGuiFormBuilderConfiguration.PARAM_GROUP_UIOPTIONS, Constants.HTML_FORM_ADVANCED_MATCHING_FAILED, String.valueOf(true)); + //set detailed error-code + if (executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON) != null) { + config.putCustomParameter(AbstractGuiFormBuilderConfiguration.PARAM_GROUP_UIOPTIONS, + Constants.HTML_FORM_ADVANCED_MATCHING_FAILED_REASON, + executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON).toString()); + } + } guiBuilder.build(request, response, config, "Other login methods selection form"); 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 f4419c1c..c9f043b5 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 @@ -23,17 +23,19 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks; +import java.util.Enumeration; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang.StringEscapeUtils; +import org.springframework.stereotype.Component; + import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants; import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SelectedLoginMethod; import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; import at.gv.egiz.eaaf.core.impl.idp.controller.tasks.AbstractLocaleAuthServletTask; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang.StringEscapeUtils; -import org.springframework.stereotype.Component; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.Enumeration; /** * Handles user's selection from {@link GenerateOtherLoginMethodGuiTask}. @@ -65,12 +67,13 @@ public class ReceiveOtherLoginMethodGuiResponseTask extends AbstractLocaleAuthSe SelectedLoginMethod selection = SelectedLoginMethod.valueOf(extractUserSelection(request)); executionContext.put(Constants.REQ_SELECTED_LOGIN_METHOD_PARAMETER, selection); executionContext.remove(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED); + executionContext.remove(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON); transitionToNextTask(executionContext, selection); } catch (final Exception e) { log.error("Parsing selected login method FAILED.", e); executionContext.put(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true); - executionContext.put(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK, true); + executionContext.put(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK, true); } } 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 f17f69c3..ff994061 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,15 +1,13 @@ 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.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 com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.json.JsonMapper; -import lombok.SneakyThrows; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; +import java.util.Locale; + import org.apache.commons.lang3.RandomStringUtils; import org.junit.Assert; import org.junit.Before; @@ -26,12 +24,17 @@ import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; -import java.io.UnsupportedEncodingException; -import java.text.MessageFormat; -import java.util.Locale; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.json.JsonMapper; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +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 = { @@ -82,8 +85,9 @@ public class GenerateOtherLoginMethodGuiTaskTest { @Test @SneakyThrows public void jsonResponse() throws TaskExecutionException, UnsupportedEncodingException { - + String reason = RandomStringUtils.randomAlphabetic(5); executionContext.put(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true); + executionContext.put(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON, reason); httpReq.addHeader("Accept", "application/json"); task.execute(pendingReq, executionContext); @@ -98,20 +102,44 @@ public class GenerateOtherLoginMethodGuiTaskTest { 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()); - + assertNotNull("advancedMatchingFailedReason", json.get(Constants.HTML_FORM_ADVANCED_MATCHING_FAILED_REASON)); + assertEquals("advancedMatchingFailedReason", reason, + json.get(Constants.HTML_FORM_ADVANCED_MATCHING_FAILED_REASON).asText()); + } @Test public void advancedMatchingFailedMsg() throws TaskExecutionException, UnsupportedEncodingException { - executionContext.put(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true); task.execute(pendingReq, executionContext); + + String html = doBasicValidation(); + Assert.assertTrue("Missing eIDAS infos", + html.contains(MessageFormat.format(TEST_PATTER_REQ_PARAM, SelectedLoginMethod.ADD_ME_AS_NEW))); + Assert.assertTrue("missing errorfield", + html.contains("
")); + + return html; } } -- cgit v1.2.3