diff options
author | Thomas <> | 2021-07-07 09:31:43 +0200 |
---|---|---|
committer | Thomas <> | 2021-07-07 09:31:43 +0200 |
commit | cbf1d0408519d0763a1a87b733c16a1ba5d022ba (patch) | |
tree | 6a714ea861f3d6687e4105a075124cc98eab8074 | |
parent | 249e3805da249afafe164ae7dc43884ba3777727 (diff) | |
download | National_eIDAS_Gateway-cbf1d0408519d0763a1a87b733c16a1ba5d022ba.tar.gz National_eIDAS_Gateway-cbf1d0408519d0763a1a87b733c16a1ba5d022ba.tar.bz2 National_eIDAS_Gateway-cbf1d0408519d0763a1a87b733c16a1ba5d022ba.zip |
add HTML template for additional eID information
13 files changed, 411 insertions, 20 deletions
diff --git a/basicConfig/properties/messages.properties b/basicConfig/properties/messages.properties index 9f7f8f7c..60ab474e 100644 --- a/basicConfig/properties/messages.properties +++ b/basicConfig/properties/messages.properties @@ -31,6 +31,13 @@ gui.countryselection.infos.general.part.4=, which regulates the mutual cross-bor gui.countryselection.infos.general.part.5=After selecting your home country on this page, you are forwarded to the familiar login environment of the selected member state. There, you can login with your eID as usual. After successful completion of the login process, you are automatically forwarded and logged in to the online service, from which you have been redirected to this page. During your first login, your eID data is also registered in the gui.countryselection.infos.general.part.6=This ensures that you will also be successfully and uniquely identified in subsequent logins at Austrian online services. +gui.matching.otherloginmethod.header=Assignment of your login information +gui.matching.otherloginmethod.info.text=Your login information could not be clearly integrated into the Austrian eID system. Further information is required for an unique integration. +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.countryselection.country.be=Belgium gui.countryselection.country.be.logo.alt=Belgium-eID gui.countryselection.country.hr=Croatia @@ -95,4 +102,4 @@ gui.countryselection.country.testcountry.logo.alt=Testcountry-eID gui.countryselection.mode.prod=Production gui.countryselection.mode.qs=QS gui.countryselection.mode.test=Test -gui.countryselection.mode.dev=Development
\ No newline at end of file +gui.countryselection.mode.dev=Development diff --git a/basicConfig/templates/other_login_method.html b/basicConfig/templates/other_login_method.html new file mode 100644 index 00000000..1e2fb8f3 --- /dev/null +++ b/basicConfig/templates/other_login_method.html @@ -0,0 +1,218 @@ +<!DOCTYPE html> +<html xmlns:th="http://www.thymeleaf.org" + xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" + layout:decorator="fragments/base" + th:with="lang=${#locale.language}" th:lang="${lang}"> +<head> + <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="stylesheet" href="$contextPath/static/css/css_country.css" th:href="@{/static/css/css_country.css}"/> + <title th:text="#{gui.countryselection.title}">eIDAS-Login Länderauswahl</title> +<script type="text/javascript"> +</script> +<style> +body { + background-image: none; + margin: 0px; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; +} + +div.header { + background-color: #e9ecef; + padding-top: 28px; + padding-left: 137px; + padding-right: 137px; + padding-bottom: 12px; +} +div.titlebar { + padding: 0px; +} +div.titlebar div { +} +.hidden { + display: none; +} +ul.nav_oben { + padding: 0px; + margin: 0px; + text-align: right; + text-transform: uppercase; +} +li { + display: inline-block; +} +div.header a { + text-decoration: none; + color: black; +} +a { + text-decoration: none; + color: #a22c1c; +} +.block { + /* override country.css */ + padding-bottom: 20px; +} +@media only screen and (min-width: 1000px) { + div.header { + padding-left: 137px; + padding-right: 137px; + } + .content { + padding-left: 137px; + padding-right: 137px; + } + footer { + padding-left: 137px; + padding-right: 137px; + } +} +@media only screen and (max-width: 999px) { + div.header { + padding-left: 1em; + padding-right: 1em; + } + .content { + padding-left: 1em; + padding-right: 1em; + } + footer { + padding-left: 1em; + padding-right: 1em; + } +} + +div.subtitle h1 { + padding: 0px; + margin: 0px; + font-size: 130%; + align: right; +} +div.subtitle h2 { + padding: 0px; + margin: 0px; + font-size: 115%; +} +footer { + left: 0; + padding-top: 1em; + bottom: 0; + width: 100%; + height: 2em; + background-color: rgb(162,44,28); + color: white; +} +.float { + float: left; +} +.floatright { + float: right; +} +.copyright { + width: 66%; + font-size: 80%; +} +#countries { + padding-bottom: 40px; +} +#country { + padding-bottom: 20px; +} +input[type=submit] { + width: inherit; +/* text-align: left; */ +} +form { + justify-content: center; +} +</style> +</head> +<body> + <div class="header container"> + <div class="titlebar"> + <div> + <a href="https://www.bmi.gv.at/" target="_blank" title="Home"> + <img class="toplogo img-responsive" src="/static/BMI.png" alt="Logo BMI" + th:attr="alt=#{gui.countryselection.logo.bmi.alt}"> + <h1 class="hidden" th:text="#{gui.countryselection.header1}"> Bundesministerium für Inneres </h1> + </a> + </div> + <ul class="nav_oben"> + <li> + <div class="languageselection" th:include="language_selection :: selectlanguage"> + LanguageSelectionBlock + </div> + </li> + + <li><a href="https://www.bmi.gv.at/" target="_blank" th:text="#{gui.countryselection.link.bmi}" > Startseite BMI </a></li> + </ul> + </div> + </div> + <div class="content"> + <div class="subtitle"> + <h1 th:text="#{gui.countryselection.header2}" > Zentraler eIDAS Knoten der Republik Österreich </h1> + <h2 th:text="#{gui.countryselection.header3}" > Betrieben durch das Bundesministerium für Inneres </h2> + </div> + + <h1 th:text="#{gui.matching.otherloginmethod.header}"> Zuordnung Ihrer Anmeldeinformationen </h1> + + <p th:text="#{gui.matching.otherloginmethod.info.text}" >Ihre Anmeldeinformationen konnten nicht eindeutig in das österreichische eID System integriert werden. + Für eine eindeutig Integration sind weitere Informationen erforderlich. </p> + + + <div id="country"> + <form class="block" method="post" action="$contextPath$submitEndpoint" th:attr="action=@{${submitEndpoint}}"> + <input type="submit" role="button" value="Sie verfügen über einen ID Austria" th:attr="value=#{gui.matching.otherloginmethod.ida}" /> + <input type="hidden" name="loginSelection" value="MOBILE_PHONE_SIGNATURE_LOGIN"> + <input type="hidden" name="pendingid" value="$pendingid" th:attr="value=${pendingid}" /> + </form> + + <!-- add this block if additional eIDAS authentication is implemented --> + <!--form class="block" method="post" action="$contextPath$submitEndpoint" th:attr="action=@{${submitEndpoint}}"> + <input type="submit" role="button" value="Sie können zusätzliche Informationen via eIDAS bereitstellen" th:attr="value=#{gui.matching.otherloginmethod.eidas}" /> + <input type="hidden" name="loginSelection" value="EIDAS_LOGIN"> + <input type="hidden" name="pendingid" value="$pendingid" th:attr="value=${pendingid}" /> + </form--> + + <form class="block" method="post" action="$contextPath$submitEndpoint" th:attr="action=@{${submitEndpoint}}"> + <input type="submit" role="button" value="Sie waren bereits einmal in Österreich wohnhaft" th:attr="value=#{gui.matching.otherloginmethod.residence}" /> + <input type="hidden" name="loginSelection" value="NO_OTHER_LOGIN"> + <input type="hidden" name="pendingid" value="$pendingid" th:attr="value=${pendingid}" /> + </form> + </div> + + + <!-- Abbrechen Button --> + <form class="block" method="post" action="$contextPath$submitEndpoint" th:attr="action=@{${submitEndpoint}}"> + <input type="submit" class="btn btn-outline-primary btn-block" value="Abbrechen/Cancel" th:attr="value=#{gui.countryselection.cancel}"> + <input type="hidden" name="stopAuthProcess" value="true" > + <input type="hidden" name="pendingid" value="$pendingid" th:attr="value=${pendingid}"> + </form> + + +<h2 th:text="#{gui.countryselection.infos.general.header}" > Information zur Anmeldung über Europäische eIDs </h2> +<p> + <span th:text="#{gui.countryselection.infos.general.part.1}"> first part </span> + <a href="https://www.bmi.gv.at/" target="_blank" th:text="#{gui.countryselection.header1}" > Bundesministerium für Inneres </a> + <span th:text="#{gui.countryselection.infos.general.part.2}"> second part </span> +</p> + +<p> + <span th:text="#{gui.countryselection.infos.general.part.3}"> third part </span> + <a href="https://eur-lex.europa.eu/legal-content/DE/TXT/HTML/?uri=CELEX:32014R0910&from=DE" target="_blank" th:text="#{gui.countryselection.infos.general.link.1}"> eIDAS-Verordnung der Europäischen Union </a> + <span th:text="#{gui.countryselection.infos.general.part.4}"> fourth part </span> +</p> + +<p + <span th:text="#{gui.countryselection.infos.general.part.5}"> fived part </span> + <a href="https://www.dsb.gv.at/-/das-erganzungsregister-fur-naturliche-personen-ernp-" target="_blank" th:text="#{gui.countryselection.infos.general.link.2}" ></a> + <span th:text="#{gui.countryselection.infos.general.part.6}"> sixed part </span> +</p> + + </div> + <footer> + <div class="copyright">© BUNDESMINISTERIUM FÜR INNERES</div> + <div></div> + </footer> +</body> +</html> diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/ProcessEngineSignalController.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/ProcessEngineSignalController.java index 1bf1ad67..6e2879a8 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/ProcessEngineSignalController.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/controller/ProcessEngineSignalController.java @@ -46,7 +46,8 @@ import at.gv.egiz.eaaf.core.impl.idp.controller.AbstractProcessEngineSignalContr public class ProcessEngineSignalController extends AbstractProcessEngineSignalController { @RequestMapping(value = { - MsEidasNodeConstants.ENDPOINT_COUNTRYSELECTION + MsEidasNodeConstants.ENDPOINT_COUNTRYSELECTION, + MsEidasNodeConstants.ENDPOINT_OTHER_LOGIN_METHOD_SELECTION }, method = { RequestMethod.POST, RequestMethod.GET }) public void performGenericAuthenticationProcess(HttpServletRequest req, HttpServletResponse resp) diff --git a/connector/src/main/resources/specific_eIDAS_connector.beans.xml b/connector/src/main/resources/specific_eIDAS_connector.beans.xml index 4608086e..ec16a7d2 100644 --- a/connector/src/main/resources/specific_eIDAS_connector.beans.xml +++ b/connector/src/main/resources/specific_eIDAS_connector.beans.xml @@ -13,9 +13,6 @@ <import resource="common_gui.beans.xml"/> - <bean id="WebResourceConfiguration" - class="at.asitplus.eidas.specific.connector.config.StaticResourceConfiguration" /> - <bean id="processEngineSignalController" class="at.asitplus.eidas.specific.connector.controller.ProcessEngineSignalController" /> diff --git a/connector/src/test/resources/spring/SpringTest_connector.beans.xml b/connector/src/test/resources/spring/SpringTest_connector.beans.xml index ac5455d3..81fff7dd 100644 --- a/connector/src/test/resources/spring/SpringTest_connector.beans.xml +++ b/connector/src/test/resources/spring/SpringTest_connector.beans.xml @@ -19,7 +19,7 @@ class="at.gv.egiz.eaaf.core.impl.idp.auth.services.DefaultErrorService"/> <bean id="WebResourceConfiguration" - class="at.asitplus.eidas.specific.connector.config.StaticResourceConfiguration" /> + class="at.asitplus.eidas.specific.connector.gui.config.StaticResourceConfiguration" /> <bean id="ProcessEngineSignalController" class="at.asitplus.eidas.specific.connector.controller.ProcessEngineSignalController" /> diff --git a/connector_lib/pom.xml b/connector_lib/pom.xml index 8ed561f3..a8a88e71 100644 --- a/connector_lib/pom.xml +++ b/connector_lib/pom.xml @@ -28,6 +28,14 @@ <artifactId>spring-webmvc</artifactId> </dependency> <dependency> + <groupId>org.thymeleaf</groupId> + <artifactId>thymeleaf-spring5</artifactId> + </dependency> + <dependency> + <groupId>org.hibernate.validator</groupId> + <artifactId>hibernate-validator</artifactId> + </dependency> + <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> </dependency> @@ -37,6 +45,8 @@ <artifactId>javax.servlet-api</artifactId> <scope>provided</scope> </dependency> + + <!-- jUnit test dependencies --> <dependency> diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/config/StaticResourceConfiguration.java b/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/config/StaticResourceConfiguration.java index a1e953f1..1f357674 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/config/StaticResourceConfiguration.java +++ b/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/config/StaticResourceConfiguration.java @@ -21,7 +21,7 @@ * that you distribute must include a readable copy of the "NOTICE" text file. */ -package at.asitplus.eidas.specific.connector.config; +package at.asitplus.eidas.specific.connector.gui.config; import java.net.MalformedURLException; import java.util.List; diff --git a/connector_lib/src/main/resources/common_gui.beans.xml b/connector_lib/src/main/resources/common_gui.beans.xml index 969a40f7..fc19efdc 100644 --- a/connector_lib/src/main/resources/common_gui.beans.xml +++ b/connector_lib/src/main/resources/common_gui.beans.xml @@ -11,6 +11,9 @@ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd"> + <bean id="WebResourceConfiguration" + class="at.asitplus.eidas.specific.connector.gui.config.StaticResourceConfiguration" /> + <bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean" primary="true"> diff --git a/eidas_modules/authmodule-eIDAS-v2/pom.xml b/eidas_modules/authmodule-eIDAS-v2/pom.xml index 0477ee23..95ad2856 100644 --- a/eidas_modules/authmodule-eIDAS-v2/pom.xml +++ b/eidas_modules/authmodule-eIDAS-v2/pom.xml @@ -103,6 +103,12 @@ <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-tomcat</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.apache.commons</groupId> @@ -171,7 +177,12 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> - </dependency> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-tomcat</artifactId> + <scope>test</scope> + </dependency> <dependency> <groupId>com.github.skjolber</groupId> <artifactId>mockito-soap-cxf</artifactId> 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 8c3cc994..dbdda78e 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,12 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.factory.annotation.Autowired; +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; @@ -32,11 +38,6 @@ 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.idp.auth.modules.AbstractAuthServletTask; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; /** * Task that provides GUI for user to select an alternative login method. 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 0eb56d0b..8431d968 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 @@ -36,7 +36,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SelectedLoginMethod; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.InvalidUserInputException; 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.idp.auth.modules.AbstractAuthServletTask; +import at.gv.egiz.eaaf.core.impl.idp.controller.tasks.AbstractLocaleAuthServletTask; import lombok.extern.slf4j.Slf4j; /** @@ -62,11 +62,11 @@ import lombok.extern.slf4j.Slf4j; */ @Slf4j @Component("ReceiveOtherLoginMethodGuiResponseTask") -public class ReceiveOtherLoginMethodGuiResponseTask extends AbstractAuthServletTask { +public class ReceiveOtherLoginMethodGuiResponseTask extends AbstractLocaleAuthServletTask { @Override - public void execute(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) - throws TaskExecutionException { + public void executeWithLocale(ExecutionContext executionContext, HttpServletRequest request, + HttpServletResponse response) throws TaskExecutionException { try { SelectedLoginMethod selection = SelectedLoginMethod.valueOf(extractUserSelection(request)); executionContext.put(Constants.REQ_SELECTED_LOGIN_METHOD_PARAMETER, selection); 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 new file mode 100644 index 00000000..0b169ca4 --- /dev/null +++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java @@ -0,0 +1,143 @@ +package at.asitplus.eidas.specific.modules.auth.eidas.v2.test.tasks; + +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; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +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; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = { + "/SpringTest-context_tasks_test.xml", + "/SpringTest-context_basic_mapConfig.xml", + "/common_gui.beans.xml" +}) +@WebAppConfiguration +public class GenerateOtherLoginMethodGuiTaskTest { + + private static final String TEST_PATTER_REQ_PARAM = + "<input type=\"hidden\" name=\"loginSelection\" value=\"{0}\">"; + + @Autowired GenerateOtherLoginMethodGuiTask task; + + private ExecutionContextImpl executionContext = new ExecutionContextImpl(); + private TestRequestImpl pendingReq; + private MockHttpServletRequest httpReq; + private MockHttpServletResponse httpResp; + + /** + * jUnit test set-up. + * + */ + @Before + public void initialize() { + httpReq = new MockHttpServletRequest("POST", "https://localhost/ms_connector"); + httpResp = new MockHttpServletResponse(); + RequestContextHolder.resetRequestAttributes(); + RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(httpReq, httpResp)); + + pendingReq = new TestRequestImpl(); + pendingReq.setAuthUrl("https://localhost/ms_connector"); + pendingReq.setPendingReqId(RandomStringUtils.randomAlphanumeric(10)); + + LocaleContextHolder.resetLocaleContext(); + } + + @Test + public void validHtmlResponseWithOutLocale() throws TaskExecutionException, UnsupportedEncodingException { + + task.execute(pendingReq, executionContext); + + //result validation + String html = doBasicValidation(); + + Assert.assertTrue("No english text", + html.contains("Information on Logins with European eIDs")); + + } + + @Test + public void validHtmlResponseWithDE() throws TaskExecutionException, UnsupportedEncodingException { + LocaleContextHolder.setLocale(Locale.GERMAN); + httpReq.addHeader("Accept-Language", "de"); + + task.execute(pendingReq, executionContext); + + //result validation + String html = doBasicValidation(); + + Assert.assertTrue("No english text", + html.contains("Information zur Anmeldung über Europäische eIDs")); + + } + + @Test + public void validHtmlResponseWithEN() throws TaskExecutionException, UnsupportedEncodingException { + LocaleContextHolder.setLocale(Locale.ENGLISH); + + task.execute(pendingReq, executionContext); + + //result validation + String html = doBasicValidation(); + + Assert.assertTrue("No english text", + html.contains("Information on Logins with European eIDs")); + + } + + @Test + public void validHtmlResponseWithFR() throws TaskExecutionException, UnsupportedEncodingException { + LocaleContextHolder.setLocale(Locale.FRANCE); + httpReq.addHeader("Accept-Language", "fr"); + + task.execute(pendingReq, executionContext); + + //result validation + String html = doBasicValidation(); + + Assert.assertTrue("No english text", + html.contains("Information on Logins with European eIDs")); + + } + + private String doBasicValidation() throws UnsupportedEncodingException { + Assert.assertEquals("Wrong http StatusCode", 200, httpResp.getStatus()); + Assert.assertEquals("Wrong http ContentType", "text/html;charset=UTF-8", httpResp.getContentType()); + + String html = httpResp.getContentAsString(); + Assert.assertNotNull("html result is null", html); + Assert.assertFalse("html result is empty", html.isEmpty()); + + Assert.assertTrue("Missing IDA Login", + html.contains(MessageFormat.format(TEST_PATTER_REQ_PARAM, SelectedLoginMethod.MOBILE_PHONE_SIGNATURE_LOGIN))); + Assert.assertTrue("Missing residence infos", + html.contains(MessageFormat.format(TEST_PATTER_REQ_PARAM, SelectedLoginMethod.NO_OTHER_LOGIN))); + + Assert.assertTrue("No language selector with pendingRequestId", + html.contains("/otherLoginMethod?pendingid=" + pendingReq.getPendingRequestId())); + Assert.assertTrue("No country-selection form", + html.contains("<form class=\"block\" method=\"post\" action=\"/otherLoginMethod\">")); + + return html; + + } +} diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/config/junit_config_1.properties b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/config/junit_config_1.properties index f5895f76..9e6876f4 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/config/junit_config_1.properties +++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/config/junit_config_1.properties @@ -19,9 +19,9 @@ eidas.ms.revisionlog.write.MDS.into.revisionlog=true eidas.ms.revisionlog.logIPAddressOfUser=true ##Directory for static Web content -eidas.ms.webcontent.static.directory=webcontent/ -eidas.ms.webcontent.templates=templates/ -eidas.ms.webcontent.properties=properties/messages +eidas.ms.webcontent.static.directory=../../../../../../basicConfig/webcontent/ +eidas.ms.webcontent.templates=../../../../../../basicConfig/templates/ +eidas.ms.webcontent.properties=../../../../../../basicConfig/properties/messages ## extended validation of pending-request Id's eidas.ms.core.pendingrequestid.maxlifetime=300 |