From 8af25296dddd9cf3c43931f8cb4d552bb94ebf3d Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 10 Mar 2022 10:42:56 +0100 Subject: fix(matching): store pendingRequest and set relayState again in case of ms-connector staging --- .../eidas/v2/tasks/ReceiveAuthnResponseAlternativeTask.java | 12 +++++++++--- .../eidas/v2/test/tasks/ReceiveAuthnResponseTaskTest.java | 3 +++ 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAuthnResponseAlternativeTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAuthnResponseAlternativeTask.java index b18c6a36..690ce0bd 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAuthnResponseAlternativeTask.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAuthnResponseAlternativeTask.java @@ -49,6 +49,7 @@ import at.gv.egiz.eaaf.core.impl.idp.auth.data.EidAuthProcessDataWrapper; import at.gv.egiz.eaaf.core.impl.idp.auth.modules.AbstractAuthServletTask; import eu.eidas.auth.commons.EidasParameterKeys; import eu.eidas.auth.commons.light.ILightResponse; +import eu.eidas.auth.commons.light.impl.LightResponse; import eu.eidas.auth.commons.tx.BinaryLightToken; import eu.eidas.specificcommunication.BinaryLightTokenHelper; import eu.eidas.specificcommunication.SpecificCommunicationDefinitionBeanNames; @@ -166,18 +167,23 @@ public class ReceiveAuthnResponseAlternativeTask extends AbstractAuthServletTask } private void forwardToOtherStage(HttpServletResponse response, ExecutionContext executionContext, - ILightResponse eidasResponse, String stagingEndpoint) throws SpecificCommunicationException, IOException { + ILightResponse eidasResponse, String stagingEndpoint) + throws SpecificCommunicationException, IOException, EaafException { executionContext.put(MsEidasNodeConstants.EXECCONTEXT_PARAM_MSCONNECTOR_STAGING, true); - + final SpecificCommunicationService specificConnectorCommunicationService = (SpecificCommunicationService) context.getBean( SpecificCommunicationDefinitionBeanNames.SPECIFIC_CONNECTOR_COMMUNICATION_SERVICE.toString()); - BinaryLightToken token = specificConnectorCommunicationService.putResponse(eidasResponse); + BinaryLightToken token = specificConnectorCommunicationService.putResponse( + LightResponse.builder(eidasResponse).relayState(pendingReq.getPendingRequestId()).build()); final String tokenBase64 = BinaryLightTokenHelper.encodeBinaryLightTokenBase64(token); final UriComponentsBuilder redirectUrl = UriComponentsBuilder.fromHttpUrl(stagingEndpoint); redirectUrl.queryParam(EidasParameterKeys.TOKEN.toString(), tokenBase64); + // store pendingRequest + requestStoreage.storePendingRequest(pendingReq); + log.debug("Forward to other stage .... "); response.sendRedirect(redirectUrl.build().encode().toString()); diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAuthnResponseTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAuthnResponseTaskTest.java index 87681435..a67b7f27 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAuthnResponseTaskTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAuthnResponseTaskTest.java @@ -156,6 +156,9 @@ public class ReceiveAuthnResponseTaskTest { Assert.assertEquals("msConnectorStage", true, (Boolean) executionContext.get(MsEidasNodeConstants.EXECCONTEXT_PARAM_MSCONNECTOR_STAGING)); + IRequest storedReq = storage.getPendingRequest(pendingReq.getPendingRequestId()); + Assert.assertNotNull("pendingReq not stored", storedReq); + //validate state Assert.assertEquals("Wrong http statusCode", 302, httpResp.getStatus()); Assert.assertNotNull("No redirect header", httpResp.getHeaderValue("Location")); -- cgit v1.2.3 From b5d1f18185a738eca10fd9d6298509dfa710d8ce Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 10 Mar 2022 11:13:24 +0100 Subject: fix(matching): remove staging infos to prohibit cycling forwarding --- .../auth/eidas/v2/tasks/ReceiveAuthnResponseAlternativeTask.java | 3 +++ .../modules/auth/eidas/v2/test/tasks/ReceiveAuthnResponseTaskTest.java | 2 ++ 2 files changed, 5 insertions(+) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAuthnResponseAlternativeTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAuthnResponseAlternativeTask.java index 690ce0bd..d2bd0128 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAuthnResponseAlternativeTask.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveAuthnResponseAlternativeTask.java @@ -171,6 +171,9 @@ public class ReceiveAuthnResponseAlternativeTask extends AbstractAuthServletTask throws SpecificCommunicationException, IOException, EaafException { executionContext.put(MsEidasNodeConstants.EXECCONTEXT_PARAM_MSCONNECTOR_STAGING, true); + //remove staging information because it's still in use + pendingReq.setRawDataToTransaction(MsEidasNodeConstants.EXECCONTEXT_PARAM_MSCONNECTOR_STAGING, null); + final SpecificCommunicationService specificConnectorCommunicationService = (SpecificCommunicationService) context.getBean( SpecificCommunicationDefinitionBeanNames.SPECIFIC_CONNECTOR_COMMUNICATION_SERVICE.toString()); diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAuthnResponseTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAuthnResponseTaskTest.java index a67b7f27..842c8bf7 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAuthnResponseTaskTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAuthnResponseTaskTest.java @@ -158,6 +158,8 @@ public class ReceiveAuthnResponseTaskTest { IRequest storedReq = storage.getPendingRequest(pendingReq.getPendingRequestId()); Assert.assertNotNull("pendingReq not stored", storedReq); + Assert.assertNull("staging info is not null", storedReq.getRawData( + MsEidasNodeConstants.EXECCONTEXT_PARAM_MSCONNECTOR_STAGING, String.class)); //validate state Assert.assertEquals("Wrong http statusCode", 302, httpResp.getStatus()); -- cgit v1.2.3 From 9a9c5e8696b4bcff1c4511b5edbc44ca0e48799a Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 10 Mar 2022 12:23:42 +0100 Subject: test(matching): add a few more E2E tests --- .../test/clients/ErnpRestClientProductionTest.java | 25 ++++++++++++++++++++++ .../v2/test/clients/SzrClientProductionTest.java | 24 +++++++++++++++++++++ 2 files changed, 49 insertions(+) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientProductionTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientProductionTest.java index 66a426a1..fc0f7698 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientProductionTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientProductionTest.java @@ -411,6 +411,31 @@ public class ErnpRestClientProductionTest { } + @Ignore + @Test + @SneakyThrows + public void addErnpEntryE2ETest() { + final String personalIdentifierFirst = "adfasfsadvsafsafweqrwr432553324"; + final String cc = "EE"; + final SimpleEidasData eidasDataFirst = SimpleEidasData.builder() + .citizenCountryCode(cc) + .familyName("Mustermatch01") + .givenName("Max") + .dateOfBirth("1965-01-01") + .personalIdentifier(cc + "/AT/" + personalIdentifierFirst) + .pseudonym(personalIdentifierFirst) + .build(); + + // execute operation + ErnpRegisterResult resp = client.add(eidasDataFirst); + + // validate state + assertNotNull("no ERnP response", resp); + assertEquals("wrong resp size", 1, resp.getPersonResult().size()); + checkErnpResult(resp.getPersonResult().get(0), eidasDataFirst, 1); + + } + @Test @SneakyThrows public void addRandomErnpEntry() { diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/SzrClientProductionTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/SzrClientProductionTest.java index fb52a729..d2bfe662 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/SzrClientProductionTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/SzrClientProductionTest.java @@ -23,6 +23,8 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.test.clients; +import static org.junit.Assert.assertNotNull; + import java.util.List; import org.apache.commons.lang3.RandomStringUtils; @@ -42,6 +44,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants; import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.szr.SzrClient; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.MatchedPersonResult; import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasSAuthenticationException; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.SzrCommunicationException; @@ -73,6 +76,27 @@ public class SzrClientProductionTest { } + + @Ignore + @Test + public void getEncBaseId() throws SzrCommunicationException { + + MatchedPersonResult matchingResult = MatchedPersonResult.builder() + .bpk("QusNG6WEct/vkD1aoRfxHod0Dtk=") + .familyName("Garcia") + .givenName("javier") + .dateOfBirth("1964-12-31") + .build(); + + + String baseId = szrClient.getEncryptedStammzahl(matchingResult); + + + assertNotNull("not encrypted baseId", baseId); + + } + + @Test public void getEidasBind() throws EidasSAuthenticationException { String vsz = RandomStringUtils.randomAlphanumeric(10); -- cgit v1.2.3 From 85346a1a30275f67e9e00b536cb05c8d7e85d1b1 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 10 Mar 2022 13:25:48 +0100 Subject: fix(core): add missing 'asynch' flags into process definition --- .../src/main/resources/eIDAS.Authentication.process.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml b/modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml index 49ac0e3a..4e5b077e 100644 --- a/modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml +++ b/modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml @@ -13,10 +13,10 @@ - - + + - + -- cgit v1.2.3 From ad7891d0c51adac7498f85558652c6fdf613ccce Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 10 Mar 2022 13:53:12 +0100 Subject: fix(matching): unset flag from ExecutionContext that raise into a loop --- .../eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java | 3 ++- .../test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'modules') 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 c9f043b5..8611be81 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 @@ -65,9 +65,10 @@ public class ReceiveOtherLoginMethodGuiResponseTask extends AbstractLocaleAuthSe HttpServletResponse response) { try { SelectedLoginMethod selection = SelectedLoginMethod.valueOf(extractUserSelection(request)); + executionContext.put(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK, false); 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); + executionContext.remove(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON); transitionToNextTask(executionContext, selection); } catch (final Exception e) { 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 da8a7497..6ec7d6e0 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 @@ -4,8 +4,6 @@ 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; @@ -76,21 +74,29 @@ public class ReceiveOtherLoginMethodGuiResponseTaskTest { @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)); + } @Test public void withEidasSelection() throws TaskExecutionException { testTransition(SelectedLoginMethod.EIDAS_LOGIN, Constants.TRANSITION_TO_GENERATE_EIDAS_LOGIN); + assertEquals("return to selection", false, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK)); + } @Test public void withNoOtherLoginSelection() throws TaskExecutionException { testTransition(SelectedLoginMethod.NO_OTHER_LOGIN, Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK); + assertEquals("return to selection", false, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK)); + } @Test public void withAddMeAsNewSelection() throws TaskExecutionException { testTransition(SelectedLoginMethod.ADD_ME_AS_NEW, Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK); + assertEquals("return to selection", false, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK)); + } public void testTransition(SelectedLoginMethod loginMethod, String expectedTransition) throws TaskExecutionException { -- cgit v1.2.3 From 18b7f8ece152958f8c4978c375cc9844335221df Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 10 Mar 2022 14:04:03 +0100 Subject: chore: implement asynch. health-check for IDA metadata --- .../provider/IdAustriaClientAuthHealthCheck.java | 32 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/provider/IdAustriaClientAuthHealthCheck.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/provider/IdAustriaClientAuthHealthCheck.java index b54b501d..32bbfa54 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/provider/IdAustriaClientAuthHealthCheck.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/provider/IdAustriaClientAuthHealthCheck.java @@ -1,5 +1,11 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.idaustriaclient.provider; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + import org.apache.commons.lang3.StringUtils; import org.opensaml.saml.saml2.metadata.EntityDescriptor; import org.springframework.beans.factory.annotation.Autowired; @@ -21,6 +27,8 @@ import net.shibboleth.utilities.java.support.resolver.ResolverException; @Slf4j public class IdAustriaClientAuthHealthCheck implements HealthIndicator { + private static final int DEADLINE = 3; + @Autowired IConfiguration authConfig; @Autowired IdAustriaClientAuthMetadataProvider metadataService; @@ -35,19 +43,35 @@ public class IdAustriaClientAuthHealthCheck implements HealthIndicator { } + CompletableFuture asynchTestOperation = new CompletableFuture<>(); + Executors.newCachedThreadPool().submit(() -> runConnectionTest(asynchTestOperation, msNodeEntityID)); + try { + return asynchTestOperation.get(DEADLINE, TimeUnit.SECONDS); + + } catch (InterruptedException | ExecutionException | TimeoutException e) { + log.warn("Receive no respose from Health-Check after {} seconds.", DEADLINE, e); + return Health.outOfService().withException(e).build(); + + } + + + } + + + private void runConnectionTest(CompletableFuture completableFuture, String entityId) { try { EntityDescriptor connectorMetadata = - metadataService.getEntityDescriptor(msNodeEntityID); + metadataService.getEntityDescriptor(entityId); if (connectorMetadata != null) { - return Health.up().build(); + completableFuture.complete(Health.up().build()); } else { - return Health.outOfService().withDetail("Reason", "No SAML2 metadata").build(); + completableFuture.complete(Health.outOfService().withDetail("Reason", "No SAML2 metadata").build()); } } catch (ResolverException e) { - return Health.down(e).build(); + completableFuture.complete(Health.down(e).build()); } -- cgit v1.2.3 From 7405ddcd0bd5326c1a0e2e187086a90caad8ebea Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 10 Mar 2022 14:54:04 +0100 Subject: chore(matching): set REST endpoint for search-address wizerd by GUI model parameter --- .../auth/eidas/v2/controller/AdresssucheController.java | 2 +- .../eidas/v2/tasks/GenerateAustrianResidenceGuiTask.java | 12 +++++++++--- .../asitplus/eidas/specific/core/MsEidasNodeConstants.java | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/controller/AdresssucheController.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/controller/AdresssucheController.java index 9a42af04..5dc9d3ef 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/controller/AdresssucheController.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/controller/AdresssucheController.java @@ -151,7 +151,7 @@ public class AdresssucheController { /** * Performs search for addresses in ZMR. */ - @RequestMapping(value = {"/residency/search"}, method = {RequestMethod.POST}) + @RequestMapping(value = {MsEidasNodeConstants.ENDPOINT_RESIDENCY_SEARCH}, method = {RequestMethod.POST}) public ResponseEntity search( @RequestParam(PARAM_POSTLEITZAHL) String postleitzahl, @RequestParam(PARAM_MUNIPICALITY) String municipality, diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAustrianResidenceGuiTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAustrianResidenceGuiTask.java index 56415f39..120c3189 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAustrianResidenceGuiTask.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAustrianResidenceGuiTask.java @@ -31,7 +31,6 @@ import org.springframework.stereotype.Component; import at.asitplus.eidas.specific.core.MsEidasNodeConstants; import at.asitplus.eidas.specific.core.gui.StaticGuiBuilderConfiguration; -import at.gv.egiz.eaaf.core.api.gui.IGuiBuilderConfiguration; 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; @@ -48,6 +47,8 @@ import lombok.extern.slf4j.Slf4j; @Component("GenerateAustrianResidenceGuiTask") public class GenerateAustrianResidenceGuiTask extends AbstractAuthServletTask { + public static final String PARAM_FORMWIZARDPOINT = "wizardEndpoint"; + @Autowired private ISpringMvcGuiFormBuilder guiBuilder; @Autowired @@ -57,15 +58,20 @@ public class GenerateAustrianResidenceGuiTask 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(//TODO + basicConfig.getBasicConfiguration( MsEidasNodeConstants.PROP_CONFIG_WEBCONTENT_TEMPLATES_RESIDENCY, MsEidasNodeConstants.TEMPLATE_HTML_RESIDENCY), MsEidasNodeConstants.ENDPOINT_RESIDENCY_INPUT, resourceLoader); + // inject REST end-point for wizard + config.putCustomParameterWithOutEscaption(null, + PARAM_FORMWIZARDPOINT, + MsEidasNodeConstants.ENDPOINT_RESIDENCY_SEARCH); + guiBuilder.build(request, response, config, "Query Austrian residency"); } catch (final Exception e) { 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 12df7807..be5d7c7d 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 @@ -152,6 +152,7 @@ public class MsEidasNodeConstants { public static final String ENDPOINT_COUNTRYSELECTION = "/myHomeCountry"; public static final String ENDPOINT_OTHER_LOGIN_METHOD_SELECTION = "/otherLoginMethod"; public static final String ENDPOINT_RESIDENCY_INPUT = "/residency"; + public static final String ENDPOINT_RESIDENCY_SEARCH = "/residency/search"; public static final String ENDPOINT_OTHER_CONTACTS_INPUT = "/otherContacts"; public static final String ENDPOINT_MONITORING_MONITOR = "/monitoring"; public static final String ENDPOINT_MONITORING_VERIFY = "/verify"; -- cgit v1.2.3 From 51984cd48762b50cf64fc8f6aa54be1a8e7bf31a Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 10 Mar 2022 15:32:01 +0100 Subject: chore(matching): inject REST endpoint for address wizard by GUI model --- .../v2/tasks/GenerateAustrianResidenceGuiTask.java | 2 +- .../GenerateAustrianResidenceGuiTaskTest.java | 119 +++++++++++++++++++++ .../tasks/GenerateOtherLoginMethodGuiTaskTest.java | 3 - 3 files changed, 120 insertions(+), 4 deletions(-) create mode 100644 modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateAustrianResidenceGuiTaskTest.java (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAustrianResidenceGuiTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAustrianResidenceGuiTask.java index 120c3189..060f9624 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAustrianResidenceGuiTask.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAustrianResidenceGuiTask.java @@ -70,7 +70,7 @@ public class GenerateAustrianResidenceGuiTask extends AbstractAuthServletTask { // inject REST end-point for wizard config.putCustomParameterWithOutEscaption(null, PARAM_FORMWIZARDPOINT, - MsEidasNodeConstants.ENDPOINT_RESIDENCY_SEARCH); + pendingReq.getAuthUrl() + MsEidasNodeConstants.ENDPOINT_RESIDENCY_SEARCH); guiBuilder.build(request, response, config, "Query Austrian residency"); diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateAustrianResidenceGuiTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateAustrianResidenceGuiTaskTest.java new file mode 100644 index 00000000..539a41d2 --- /dev/null +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateAustrianResidenceGuiTaskTest.java @@ -0,0 +1,119 @@ +package at.asitplus.eidas.specific.modules.auth.eidas.v2.test.tasks; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.UnsupportedEncodingException; +import java.util.Locale; + +import org.apache.commons.lang3.RandomStringUtils; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +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 com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.json.JsonMapper; + +import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.GenerateAustrianResidenceGuiTask; +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 = { + "/SpringTest-context_tasks_test.xml", + "/SpringTest-context_basic_mapConfig.xml", + "/common_gui.beans.xml" +}) +@WebAppConfiguration +public class GenerateAustrianResidenceGuiTaskTest { + + + @Autowired + GenerateAustrianResidenceGuiTask task; + + private ExecutionContextImpl executionContext = new ExecutionContextImpl(); + private TestRequestImpl pendingReq; + private MockHttpServletRequest httpReq; + private MockHttpServletResponse httpResp; + + @BeforeClass + public static void classInitializer() { + Locale.setDefault(Locale.ENGLISH); + + } + + /** + * 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 + @SneakyThrows + public void jsonResponse() throws TaskExecutionException, UnsupportedEncodingException { + 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); + checkJsonElement(json, "wizardEndpoint", "https://localhost/ms_connector/residency/search"); + + } + + @Test + @SneakyThrows + public void htmlResponse() throws TaskExecutionException, UnsupportedEncodingException { + + task.execute(pendingReq, executionContext); + + //result validation + Assert.assertEquals("httpStausCode", 200, httpResp.getStatus()); + Assert.assertEquals("http ContentType", "text/html;charset=UTF-8", httpResp.getContentType()); + final String content = httpResp.getContentAsString(); + assertNotNull("response body is null", content); + Assert.assertFalse("response body is empty", content.isEmpty()); + assertTrue("no wizard endpoint", content.contains("https://localhost/ms_connector/residency/search")); + + } + + private void checkJsonElement(JsonNode json, String key, String expected) { + assertTrue("no element: " + key, json.has(key)); + assertEquals("wrong element:" + key, expected, json.get(key).asText()); + + } + + +} diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java index ff994061..68b73734 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java @@ -25,7 +25,6 @@ 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; @@ -48,8 +47,6 @@ public class GenerateOtherLoginMethodGuiTaskTest { private static final String TEST_PATTER_REQ_PARAM = ""; - private static ObjectMapper mapper = new ObjectMapper(); - @Autowired GenerateOtherLoginMethodGuiTask task; -- cgit v1.2.3 From 64a7785ffafc39b99d4a5f88adde86effdfb83bc Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 10 Mar 2022 16:22:45 +0100 Subject: fix(matching): remove requested LoA level from matching by alternative IDA login --- .../eidas/v2/tasks/GenerateMobilePhoneSignatureRequestTask.java | 4 +--- .../test/tasks/GenerateMobilePhoneSignatureRequestTaskTest.java | 8 ++------ 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateMobilePhoneSignatureRequestTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateMobilePhoneSignatureRequestTask.java index 715d3672..26282d5c 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateMobilePhoneSignatureRequestTask.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateMobilePhoneSignatureRequestTask.java @@ -139,9 +139,7 @@ public class GenerateMobilePhoneSignatureRequestTask extends AbstractAuthServlet authnReqConfig.setSignCred(credential.getMessageSigningCredential()); authnReqConfig.setSpEntityID( pendingReq.getAuthUrlWithOutSlash() + IdAustriaClientAuthConstants.ENDPOINT_METADATA); - authnReqConfig.setRequestedLoA(authConfig.getBasicConfiguration( - IdAustriaClientAuthConstants.CONFIG_PROPS_REQUIRED_LOA, - IdAustriaClientAuthConstants.CONFIG_DEFAULT_LOA_EIDAS_LEVEL)); return authnReqConfig; + } } diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateMobilePhoneSignatureRequestTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateMobilePhoneSignatureRequestTaskTest.java index e82d4122..ffa02ccd 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateMobilePhoneSignatureRequestTaskTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateMobilePhoneSignatureRequestTaskTest.java @@ -2,6 +2,7 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.test.tasks; import static org.junit.Assert.assertEquals; 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 static org.springframework.util.Assert.isInstanceOf; @@ -236,12 +237,7 @@ public class GenerateMobilePhoneSignatureRequestTaskTest { metadataFactory.createMetadataProvider(METADATA_SP_PATH, null, "jUnit SP", null)); samlVerifyEngine.verify(msg, TrustEngineFactory.getSignatureKnownKeysTrustEngine(metadataProvider)); - assertNotNull("RequestedAuthnContext", authnRequest.getRequestedAuthnContext()); - assertNotNull("AuthnContextClassRef", authnRequest.getRequestedAuthnContext().getAuthnContextClassRefs()); - assertEquals("#AuthnContextClassRef", 1, - authnRequest.getRequestedAuthnContext().getAuthnContextClassRefs().size()); - assertEquals("LoA", "http://eidas.europa.eu/LoA/high", - authnRequest.getRequestedAuthnContext().getAuthnContextClassRefs().get(0).getAuthnContextClassRef()); + assertNull("RequestedAuthnContext", authnRequest.getRequestedAuthnContext()); } -- cgit v1.2.3 From 2963c7aa8a6ba57afcbde3028f9fdf56225743c5 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 10 Mar 2022 16:23:11 +0100 Subject: chore(core): change log-level on health check to info --- .../v2/idaustriaclient/provider/IdAustriaClientAuthHealthCheck.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/provider/IdAustriaClientAuthHealthCheck.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/provider/IdAustriaClientAuthHealthCheck.java index 32bbfa54..bd5e220b 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/provider/IdAustriaClientAuthHealthCheck.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/provider/IdAustriaClientAuthHealthCheck.java @@ -49,7 +49,7 @@ public class IdAustriaClientAuthHealthCheck implements HealthIndicator { return asynchTestOperation.get(DEADLINE, TimeUnit.SECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { - log.warn("Receive no respose from Health-Check after {} seconds.", DEADLINE, e); + log.info("Receive no respose from Health-Check after {} seconds.", DEADLINE); return Health.outOfService().withException(e).build(); } -- cgit v1.2.3 From 34dff8116290845953e386c6bfd7d17224a6ad34 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 10 Mar 2022 16:49:48 +0100 Subject: chore(matching): remove some PVP attributes from IDA authentication --- .../auth/eidas/v2/idaustriaclient/IdAustriaClientAuthConstants.java | 4 ---- .../auth/eidas/v2/tasks/ReceiveMobilePhoneSignatureResponseTask.java | 2 ++ .../idaustriaclient/IdAustriaClientAuthMetadataControllerTest.java | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/IdAustriaClientAuthConstants.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/IdAustriaClientAuthConstants.java index 46d0e77d..67dfd7d8 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/IdAustriaClientAuthConstants.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/idaustriaclient/IdAustriaClientAuthConstants.java @@ -69,10 +69,6 @@ public class IdAustriaClientAuthConstants { private static final long serialVersionUID = 1L; { - // add PVP Version attribute - add(Triple.newInstance(PvpAttributeDefinitions.PVP_VERSION_NAME, - PvpAttributeDefinitions.PVP_VERSION_FRIENDLY_NAME, true)); - // entity metadata information add(Triple.newInstance(PvpAttributeDefinitions.EID_CITIZEN_EIDAS_QAA_LEVEL_NAME, PvpAttributeDefinitions.EID_CITIZEN_EIDAS_QAA_LEVEL_FRIENDLY_NAME, true)); 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 514e38ba..286b63b1 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 @@ -308,6 +308,7 @@ public class ReceiveMobilePhoneSignatureResponseTask extends AbstractAuthServlet IdAustriaClientAuthEventConstants.AUTHPROCESS_ID_AUSTRIA_RESPONSE_RECEIVED, response.getID()); return Pair.newInstance(msg, false); + } else { log.info("Receive StatusCode {} from 'ms-specific eIDAS node'.", response.getStatus().getStatusCode().getValue()); StatusCode subStatusCode = getSubStatusCode(response); @@ -315,6 +316,7 @@ public class ReceiveMobilePhoneSignatureResponseTask extends AbstractAuthServlet && IdAustriaClientAuthConstants.SAML2_STATUSCODE_USERSTOP.equals(subStatusCode.getValue())) { log.info("Find 'User-Stop operation' in SAML2 response. Stopping authentication process ... "); return Pair.newInstance(msg, true); + } revisionsLogger.logEvent(pendingReq, diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/idaustriaclient/IdAustriaClientAuthMetadataControllerTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/idaustriaclient/IdAustriaClientAuthMetadataControllerTest.java index 095a020a..b7f27204 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/idaustriaclient/IdAustriaClientAuthMetadataControllerTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/idaustriaclient/IdAustriaClientAuthMetadataControllerTest.java @@ -79,7 +79,7 @@ public class IdAustriaClientAuthMetadataControllerTest { controller.getSpMetadata(httpReq, httpResp); //check result - validateResponse(7); + validateResponse(6); } -- cgit v1.2.3 From 08ee18252a84f29913256cfabae835010442586c Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 10 Mar 2022 16:57:55 +0100 Subject: refactor(matching): set other matching option as String to prohibit staging problems --- .../auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java | 2 +- .../eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'modules') 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 8611be81..075b23c1 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 @@ -66,7 +66,7 @@ public class ReceiveOtherLoginMethodGuiResponseTask extends AbstractLocaleAuthSe try { SelectedLoginMethod selection = SelectedLoginMethod.valueOf(extractUserSelection(request)); executionContext.put(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK, false); - executionContext.put(Constants.REQ_SELECTED_LOGIN_METHOD_PARAMETER, selection); + 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); 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 6ec7d6e0..750a17ce 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 @@ -108,7 +108,7 @@ public class ReceiveOtherLoginMethodGuiResponseTaskTest { assertFalse("wrong pendingReq auth flag", pendingReq.isAuthenticated()); assertFalse("wrong process-cancelled flag", executionContext.isProcessCancelled()); 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("Wrong login-selection found", loginMethod.name(), 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)); -- cgit v1.2.3 From df962dfa24bf11b67c8ffbca0e581ef36613b004 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 10 Mar 2022 17:31:38 +0100 Subject: fix(matching): add missing controller for search-address wizard --- .../eidas/v2/controller/AdresssucheController.java | 64 +--------------------- .../src/main/resources/eidas_v2_auth.beans.xml | 3 + 2 files changed, 4 insertions(+), 63 deletions(-) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/controller/AdresssucheController.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/controller/AdresssucheController.java index 5dc9d3ef..99754662 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/controller/AdresssucheController.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/controller/AdresssucheController.java @@ -29,9 +29,6 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.CompareToBuilder; import org.jetbrains.annotations.NotNull; @@ -44,7 +41,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import at.asitplus.eidas.specific.core.MsEidasNodeConstants; -import at.asitplus.eidas.specific.core.gui.StaticGuiBuilderConfiguration; import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.zmr.ZmrAddressSoapClient; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasSAuthenticationException; import at.gv.bmi.namespace.zmr_su.zrm._20040201_.address.Adressdaten; @@ -54,8 +50,6 @@ import at.gv.egiz.eaaf.core.api.data.EaafConstants; 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.utils.IPendingRequestIdGenerationStrategy; -import at.gv.egiz.eaaf.core.exceptions.EaafException; -import at.gv.egiz.eaaf.core.exceptions.GuiBuildException; import at.gv.egiz.eaaf.core.exceptions.PendingReqIdValidationException; import lombok.AllArgsConstructor; import lombok.Builder; @@ -91,63 +85,7 @@ public class AdresssucheController { @Autowired private IPendingRequestIdGenerationStrategy pendingReqGeneration; - - /** - * Show the "residency.html" directly. - * TODO Remove this after testing. - */ - @RequestMapping(value = {"/test"}, method = {RequestMethod.GET}) - public void test(HttpServletRequest request, HttpServletResponse response) throws GuiBuildException, EaafException { - final StaticGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( - basicConfig, - "http://localhost:8080/ms_connector/", - basicConfig.getBasicConfiguration(//TODO - MsEidasNodeConstants.PROP_CONFIG_WEBCONTENT_TEMPLATES_RESIDENCY, - MsEidasNodeConstants.TEMPLATE_HTML_RESIDENCY), - MsEidasNodeConstants.ENDPOINT_RESIDENCY_INPUT, - resourceLoader); - config.putCustomParameter(null, "pendingid", pendingReqGeneration.generateExternalPendingRequestId()); - guiBuilder.build(request, response, config, "Query Austrian residency"); - } - - /** - * Show the "other_login_method.html" directly. - * TODO Remove this after testing. - */ - @RequestMapping(value = {"/olm"}, method = {RequestMethod.GET}) - public void otherloginmethod(HttpServletRequest request, HttpServletResponse response) throws GuiBuildException, - EaafException { - final StaticGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( - basicConfig, - "http://localhost:8080/ms_connector/", - basicConfig.getBasicConfiguration(//TODO - MsEidasNodeConstants.PROP_CONFIG_WEBCONTENT_TEMPLATES_OTHER_LOGIN_METHOD_SELECTION, - MsEidasNodeConstants.TEMPLATE_HTML_OTHERLOGINMETHODS), - MsEidasNodeConstants.ENDPOINT_OTHER_LOGIN_METHOD_SELECTION, - resourceLoader); - config.putCustomParameter(null, "pendingid", pendingReqGeneration.generateExternalPendingRequestId()); - guiBuilder.build(request, response, config, "Other Login Method"); - } - - /** - * Show the "country_selection.html" directly. - * TODO Remove this after testing. - */ - @RequestMapping(value = {"/country"}, method = {RequestMethod.GET}) - public void countryselection(HttpServletRequest request, HttpServletResponse response) throws GuiBuildException, - EaafException { - final StaticGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( - basicConfig, - "http://localhost:8080/ms_connector/", - basicConfig.getBasicConfiguration(//TODO - MsEidasNodeConstants.PROP_CONFIG_WEBCONTENT_TEMPLATES_CCSELECTION, - MsEidasNodeConstants.TEMPLATE_HTML_COUNTRYSELECTION), - MsEidasNodeConstants.ENDPOINT_COUNTRYSELECTION, - resourceLoader); - config.putCustomParameter(null, "pendingid", pendingReqGeneration.generateExternalPendingRequestId()); - guiBuilder.build(request, response, config, "Country Selection"); - } - + /** * Performs search for addresses in ZMR. */ diff --git a/modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml b/modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml index 40e63a91..193513b0 100644 --- a/modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml +++ b/modules/authmodule-eIDAS-v2/src/main/resources/eidas_v2_auth.beans.xml @@ -96,6 +96,9 @@ + + Date: Thu, 10 Mar 2022 18:04:20 +0100 Subject: fix(matching): store pendingRequest before next asynch. step --- .../auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java | 3 +++ .../eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java | 8 ++++++++ 2 files changed, 11 insertions(+) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java index 361f049b..62e5c57b 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java @@ -88,6 +88,9 @@ public class GenerateOtherLoginMethodGuiTask extends AbstractAuthServletTask { } + // store pending request before next step + requestStoreage.storePendingRequest(pendingReq); + guiBuilder.build(request, response, config, "Other login methods selection form"); } catch (final Exception e) { diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java index 68b73734..cc092004 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java @@ -30,6 +30,8 @@ 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.asitplus.eidas.specific.modules.auth.eidas.v2.test.dummy.DummyOA; +import at.gv.egiz.eaaf.core.api.IRequestStorage; 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; @@ -49,6 +51,8 @@ public class GenerateOtherLoginMethodGuiTaskTest { @Autowired GenerateOtherLoginMethodGuiTask task; + + @Autowired IRequestStorage storage; private ExecutionContextImpl executionContext = new ExecutionContextImpl(); private TestRequestImpl pendingReq; @@ -74,6 +78,7 @@ public class GenerateOtherLoginMethodGuiTaskTest { pendingReq = new TestRequestImpl(); pendingReq.setAuthUrl("https://localhost/ms_connector"); pendingReq.setPendingReqId(RandomStringUtils.randomAlphanumeric(10)); + pendingReq.setSpConfig(new DummyOA()); LocaleContextHolder.resetLocaleContext(); } @@ -103,6 +108,9 @@ public class GenerateOtherLoginMethodGuiTaskTest { assertEquals("advancedMatchingFailedReason", reason, json.get(Constants.HTML_FORM_ADVANCED_MATCHING_FAILED_REASON).asText()); + assertNotNull("pendingRequest not stored", + storage.getPendingRequest(pendingReq.getPendingRequestId())); + } @Test -- cgit v1.2.3 From 2119f7613a04651d7cc1cb9a8c7ecdc8556d07d9 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Fri, 11 Mar 2022 07:09:27 +0100 Subject: fix(matching): unset all matching releated parameters on executioncontext --- .../v2/tasks/GenerateOtherLoginMethodGuiTask.java | 7 +++-- .../ReceiveOtherLoginMethodGuiResponseTask.java | 11 ++++++++ .../tasks/GenerateOtherLoginMethodGuiTaskTest.java | 32 +++++++++++++++++++++- 3 files changed, 47 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java index 62e5c57b..f6ca0309 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java @@ -84,10 +84,13 @@ public class GenerateOtherLoginMethodGuiTask extends AbstractAuthServletTask { config.putCustomParameter(AbstractGuiFormBuilderConfiguration.PARAM_GROUP_UIOPTIONS, Constants.HTML_FORM_ADVANCED_MATCHING_FAILED_REASON, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON).toString()); - } - + } } + // reset executionContext parameters + ReceiveOtherLoginMethodGuiResponseTask.ALL_EXECUTIONCONTEXT_PARAMETERS.forEach( + el -> executionContext.remove(el)); + // store pending request before next step requestStoreage.storePendingRequest(pendingReq); 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 075b23c1..184ad499 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 @@ -24,6 +24,7 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks; import java.util.Enumeration; +import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -31,6 +32,8 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringEscapeUtils; import org.springframework.stereotype.Component; +import com.google.common.collect.Sets; + 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; @@ -60,6 +63,14 @@ import lombok.extern.slf4j.Slf4j; @Component("ReceiveOtherLoginMethodGuiResponseTask") public class ReceiveOtherLoginMethodGuiResponseTask extends AbstractLocaleAuthServletTask { + public static final Set ALL_EXECUTIONCONTEXT_PARAMETERS = Sets.newHashSet( + Constants.REQ_SELECTED_LOGIN_METHOD_PARAMETER, + Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK, + Constants.TRANSITION_TO_GENERATE_EIDAS_LOGIN, + Constants.TRANSITION_TO_GENERATE_MOBILE_PHONE_SIGNATURE_REQUEST_TASK, + Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK, + Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK); + @Override public void executeWithLocale(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) { diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java index cc092004..1751e95a 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateOtherLoginMethodGuiTaskTest.java @@ -2,6 +2,7 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.test.tasks; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.io.UnsupportedEncodingException; @@ -30,8 +31,10 @@ 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.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.ReceiveOtherLoginMethodGuiResponseTask; import at.asitplus.eidas.specific.modules.auth.eidas.v2.test.dummy.DummyOA; import at.gv.egiz.eaaf.core.api.IRequestStorage; +import at.gv.egiz.eaaf.core.api.data.EaafConstants; 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; @@ -54,7 +57,7 @@ public class GenerateOtherLoginMethodGuiTaskTest { @Autowired IRequestStorage storage; - private ExecutionContextImpl executionContext = new ExecutionContextImpl(); + private ExecutionContextImpl executionContext; private TestRequestImpl pendingReq; private MockHttpServletRequest httpReq; private MockHttpServletResponse httpResp; @@ -80,10 +83,37 @@ public class GenerateOtherLoginMethodGuiTaskTest { pendingReq.setPendingReqId(RandomStringUtils.randomAlphanumeric(10)); pendingReq.setSpConfig(new DummyOA()); + executionContext = new ExecutionContextImpl(); + LocaleContextHolder.resetLocaleContext(); } + @Test + @SneakyThrows + public void unsetExecutionContextParameters() throws TaskExecutionException, UnsupportedEncodingException { + httpReq.addHeader("Accept", "application/json"); + ReceiveOtherLoginMethodGuiResponseTask.ALL_EXECUTIONCONTEXT_PARAMETERS.forEach( + el -> executionContext.put(el, RandomStringUtils.randomAlphabetic(5))); + + // execute test + task.execute(pendingReq, executionContext); + + //result validation + Assert.assertEquals("httpStausCode", 200, httpResp.getStatus()); + Assert.assertEquals("http ContentType", "application/json;charset=UTF-8", httpResp.getContentType()); + + ReceiveOtherLoginMethodGuiResponseTask.ALL_EXECUTIONCONTEXT_PARAMETERS.forEach( + el -> assertNull("executionContext parameter: " + el, executionContext.get(el))); + + // remove pendingRequestId because it's added by default + executionContext.remove(EaafConstants.PROCESS_ENGINE_PENDINGREQUESTID); + + // in case of 'ReceiveOtherLoginMethodGuiResponseTask.ALL_EXECUTIONCONTEXT_PARAMETERS' does not include all parameters + assertTrue("ExecutionContext is not empty", executionContext.keySet().isEmpty()); + + } + @Test @SneakyThrows public void jsonResponse() throws TaskExecutionException, UnsupportedEncodingException { -- cgit v1.2.3 From 7dd718a0dcc466d5aedeef0a9b3e70005d41ab17 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Fri, 11 Mar 2022 07:43:07 +0100 Subject: fix(matching): change process-condition order to evaluate 'changeLanguage' first --- .../src/main/resources/eIDAS.Authentication.process.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml b/modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml index 4e5b077e..d72d6ac7 100644 --- a/modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml +++ b/modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml @@ -37,7 +37,7 @@ - -- cgit v1.2.3 From b9cae6d3ac35e962126bed14c870eb813e2a84fb Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Fri, 11 Mar 2022 07:46:25 +0100 Subject: chore(matching): make RegisterStatusResult serializable to store as session object --- .../modules/auth/eidas/v2/service/RegisterSearchService.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java index c3bf4309..d4ebae04 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java @@ -1,5 +1,6 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.service; +import java.io.Serializable; import java.math.BigInteger; import java.util.Collections; import java.util.List; @@ -328,8 +329,10 @@ public class RegisterSearchService { */ @AllArgsConstructor @Getter - public static class RegisterOperationStatus { + public static class RegisterOperationStatus implements Serializable { + private static final long serialVersionUID = -1037357883275379796L; + /** * ZMR internal processId that is required for any further request in the same process. */ @@ -346,7 +349,10 @@ public class RegisterSearchService { */ @Getter @RequiredArgsConstructor - public static class RegisterStatusResults { + public static class RegisterStatusResults implements Serializable { + + private static final long serialVersionUID = -2489125033838373511L; + /** * Operation status for this result. */ -- cgit v1.2.3 From a4bfb6a5aed16784fb14d8ece7bf905e21c1a0f9 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Fri, 11 Mar 2022 08:15:39 +0100 Subject: chore(matching): add common log-messages for register results during matching operations --- .../auth/eidas/v2/service/RegisterSearchService.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java index d4ebae04..5e1e4839 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/RegisterSearchService.java @@ -34,7 +34,9 @@ import lombok.extern.slf4j.Slf4j; @Service("registerSearchService") public class RegisterSearchService { - private final IZmrClient zmrClient; + private static final String LOG_MSG_RESULTS = "Matching operation: {} results: ZMR: {} | ERnP: {}"; + + private final IZmrClient zmrClient; private final IErnpClient ernpClient; private final List handlers; @@ -85,6 +87,9 @@ public class RegisterSearchService { final ErnpRegisterResult resultsErnp = ernpClient.searchWithPersonIdentifier( eidasData.getPseudonym(), eidasData.getCitizenCountryCode()); + log.debug(LOG_MSG_RESULTS, "seachByPersonalId", + resultsZmr.getPersonResult().size(), resultsErnp.getPersonResult().size()); + return RegisterStatusResults.fromZmrAndErnp(resultsZmr, resultsErnp); } catch (final EidasSAuthenticationException e) { @@ -113,6 +118,9 @@ public class RegisterSearchService { ernpClient.searchWithMds(eidasData.getGivenName(), eidasData.getFamilyName(), eidasData.getDateOfBirth(), eidasData.getCitizenCountryCode()); + log.debug(LOG_MSG_RESULTS, "seachByMDS", + resultsZmr.getPersonResult().size(), resultsErnp.getPersonResult().size()); + return RegisterStatusResults.fromZmrAndErnp(resultsZmr, resultsErnp); } catch (final EidasSAuthenticationException e) { @@ -149,6 +157,9 @@ public class RegisterSearchService { ErnpRegisterResult resultErnp = ernpClient.searchCountrySpecific( ccSpecificSearchReq, eidasData.getCitizenCountryCode()); + log.debug(LOG_MSG_RESULTS, "seachByCountrySpecifics", + resultsZmr.getPersonResult().size(), resultErnp.getPersonResult().size()); + return RegisterStatusResults.fromZmrAndErnp(resultsZmr, resultErnp); } else { @@ -183,6 +194,9 @@ public class RegisterSearchService { * because we only search for people with Austrian residence and they are in ZMR only */ + log.debug(LOG_MSG_RESULTS, "seachByResidence", + resultsZmr.getPersonResult().size(), 0); + return RegisterStatusResults.fromZmr(resultsZmr); } catch (final EidasSAuthenticationException e) { -- cgit v1.2.3 From d5c3de94f6f24b915e20810f0abd4d99e7836dcd Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Fri, 11 Mar 2022 08:16:22 +0100 Subject: fix: remove unused class members to fix code-quality issues --- .../auth/eidas/v2/controller/AdresssucheController.java | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/controller/AdresssucheController.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/controller/AdresssucheController.java index 99754662..6f49c700 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/controller/AdresssucheController.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/controller/AdresssucheController.java @@ -33,7 +33,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.CompareToBuilder; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.io.ResourceLoader; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -47,8 +46,6 @@ import at.gv.bmi.namespace.zmr_su.zrm._20040201_.address.Adressdaten; import at.gv.e_government.reference.namespace.persondata.de._20040201.PostAdresseTyp; import at.gv.e_government.reference.namespace.persondata.de._20040201.ZustelladresseTyp; import at.gv.egiz.eaaf.core.api.data.EaafConstants; -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.utils.IPendingRequestIdGenerationStrategy; import at.gv.egiz.eaaf.core.exceptions.PendingReqIdValidationException; import lombok.AllArgsConstructor; @@ -71,15 +68,6 @@ public class AdresssucheController { public static final String PARAM_STREET = "street"; public static final String PARAM_NUMBER = "number"; - @Autowired - private ISpringMvcGuiFormBuilder guiBuilder; - - @Autowired - private IConfiguration basicConfig; - - @Autowired - private ResourceLoader resourceLoader; - @Autowired private ZmrAddressSoapClient client; -- cgit v1.2.3 From 4f6e4801a171d9835a64d048b2e93f108e687fa5 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 31 Mar 2022 13:00:02 +0200 Subject: feature(core): add deny-list for Spring DataBinder This mitigates possible RCE attacked called "Spring4Shell" --- .../controller/DataBinderControllerAdvice.java | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/controller/DataBinderControllerAdvice.java (limited to 'modules') diff --git a/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/controller/DataBinderControllerAdvice.java b/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/controller/DataBinderControllerAdvice.java new file mode 100644 index 00000000..0d983c16 --- /dev/null +++ b/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/controller/DataBinderControllerAdvice.java @@ -0,0 +1,33 @@ +package at.asitplus.eidas.specific.core.controller; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.core.annotation.Order; +import org.springframework.validation.DataBinder; +import org.springframework.web.bind.WebDataBinder; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.InitBinder; + +import lombok.extern.slf4j.Slf4j; + +@ControllerAdvice +@Order(10000) +@Slf4j +public class DataBinderControllerAdvice { + + private static String[] DENYLIST = new String[] { "class.*", "Class.*", "*.class.*", "*.Class.*" }; + + /** + * Set list of form parameters that are disallowed by default. + * + * @param dataBinder Spring {@link DataBinder} implementation + */ + @InitBinder + public void setDisallowedFields(WebDataBinder dataBinder) { + // This code protects Spring Core from a "Remote Code Execution" attack (dubbed "Spring4Shell"). + // By applying this mitigation, you prevent the "Class Loader Manipulation attack vector from firing. + // For more details, see this post: https://www.lunasec.io/docs/blog/spring-rce-vulnerabilities/ + dataBinder.setDisallowedFields(DENYLIST); + log.info("Set denyList for Spring DataBinder: {}", StringUtils.join(DENYLIST, ",")); + + } +} -- cgit v1.2.3 From 7abf57f1daaf2cc3a45b48c978100426aef61d0b Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 31 Mar 2022 14:36:02 +0200 Subject: chore(core): change log-level in 'DataBinderControllerAdvice' --- .../eidas/specific/core/controller/DataBinderControllerAdvice.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/controller/DataBinderControllerAdvice.java b/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/controller/DataBinderControllerAdvice.java index 0d983c16..e69826d0 100644 --- a/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/controller/DataBinderControllerAdvice.java +++ b/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/controller/DataBinderControllerAdvice.java @@ -27,7 +27,7 @@ public class DataBinderControllerAdvice { // By applying this mitigation, you prevent the "Class Loader Manipulation attack vector from firing. // For more details, see this post: https://www.lunasec.io/docs/blog/spring-rce-vulnerabilities/ dataBinder.setDisallowedFields(DENYLIST); - log.info("Set denyList for Spring DataBinder: {}", StringUtils.join(DENYLIST, ",")); + log.trace("Set denyList for Spring DataBinder: {}", StringUtils.join(DENYLIST, ",")); } } -- cgit v1.2.3 From d9a402c18755d47ad17283c5c52fc2311df56e85 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Mon, 2 May 2022 12:24:13 +0200 Subject: fix(gui): fix possible errors on language selection by GUI operation --- .../auth/eidas/v2/tasks/GenerateAustrianResidenceGuiTask.java | 6 +++--- .../auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAustrianResidenceGuiTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAustrianResidenceGuiTask.java index 060f9624..190e28eb 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAustrianResidenceGuiTask.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAustrianResidenceGuiTask.java @@ -35,7 +35,7 @@ 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.idp.auth.modules.AbstractAuthServletTask; +import at.gv.egiz.eaaf.core.impl.idp.controller.tasks.AbstractLocaleAuthServletTask; import lombok.extern.slf4j.Slf4j; /** @@ -45,7 +45,7 @@ import lombok.extern.slf4j.Slf4j; */ @Slf4j @Component("GenerateAustrianResidenceGuiTask") -public class GenerateAustrianResidenceGuiTask extends AbstractAuthServletTask { +public class GenerateAustrianResidenceGuiTask extends AbstractLocaleAuthServletTask { public static final String PARAM_FORMWIZARDPOINT = "wizardEndpoint"; @@ -55,7 +55,7 @@ public class GenerateAustrianResidenceGuiTask extends AbstractAuthServletTask { private IConfiguration basicConfig; @Override - public void execute(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) + public void executeWithLocale(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) throws TaskExecutionException { try { final StaticGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java index f6ca0309..11da4281 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java @@ -39,7 +39,7 @@ 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 at.gv.egiz.eaaf.core.impl.idp.controller.tasks.AbstractLocaleAuthServletTask; import lombok.extern.slf4j.Slf4j; /** @@ -53,7 +53,7 @@ import lombok.extern.slf4j.Slf4j; */ @Slf4j @Component("GenerateOtherLoginMethodGuiTask") -public class GenerateOtherLoginMethodGuiTask extends AbstractAuthServletTask { +public class GenerateOtherLoginMethodGuiTask extends AbstractLocaleAuthServletTask { @Autowired private ISpringMvcGuiFormBuilder guiBuilder; @@ -62,7 +62,7 @@ public class GenerateOtherLoginMethodGuiTask extends AbstractAuthServletTask { private IConfiguration basicConfig; @Override - public void execute(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) + public void executeWithLocale(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) throws TaskExecutionException { try { final StaticGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( -- cgit v1.2.3 From 69aa81016fe20e901a3be02bb6772c9185c0b9ef Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Mon, 2 May 2022 17:16:15 +0200 Subject: chore(matching): re-oreder process steps in GUI releated matching --- .../specific/modules/auth/eidas/v2/Constants.java | 7 +++ .../v2/tasks/GenerateAustrianResidenceGuiTask.java | 26 ++++++++- .../v2/tasks/GenerateOtherLoginMethodGuiTask.java | 24 ++++---- .../ReceiveAustrianResidenceGuiResponseTask.java | 33 +++++++---- .../auth/eidas/v2/utils/MatchingTaskUtils.java | 19 +++++- .../resources/eIDAS.Authentication.process.xml | 6 +- .../messages/eidas_connector_message.properties | 3 +- .../GenerateAustrianResidenceGuiTaskTest.java | 53 +++++++++++++++++ .../tasks/GenerateOtherLoginMethodGuiTaskTest.java | 67 +++++++++++++++++++--- ...strianResidenceGuiResponseTaskRegisterTest.java | 14 +++-- ...eceiveAustrianResidenceGuiResponseTaskTest.java | 20 +++++-- 11 files changed, 221 insertions(+), 51 deletions(-) (limited to 'modules') 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 fbc211f5..0b5d086d 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 @@ -320,6 +320,7 @@ public class Constants { // UI options + public static final String HTML_FORM_CREATE_NEW_ERNP_ENTRY = "createNewErnpEntry"; 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"; @@ -347,6 +348,12 @@ public class Constants { public static final String TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK = "TASK_GenerateAustrianResidenceGuiTask"; + /** + * {@link at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.CreateNewErnpEntryTask}. + */ + public static final String TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK = "TASK_RequestingNewErnpEntryTask"; + + /** * {@link at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.GenerateMobilePhoneSignatureRequestTask}. */ diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAustrianResidenceGuiTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAustrianResidenceGuiTask.java index 190e28eb..dc57dd78 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAustrianResidenceGuiTask.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateAustrianResidenceGuiTask.java @@ -31,10 +31,13 @@ import org.springframework.stereotype.Component; import at.asitplus.eidas.specific.core.MsEidasNodeConstants; import at.asitplus.eidas.specific.core.gui.StaticGuiBuilderConfiguration; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.MatchingTaskUtils; 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.controller.tasks.AbstractLocaleAuthServletTask; import lombok.extern.slf4j.Slf4j; @@ -55,8 +58,8 @@ public class GenerateAustrianResidenceGuiTask extends AbstractLocaleAuthServletT private IConfiguration basicConfig; @Override - public void executeWithLocale(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) - throws TaskExecutionException { + public void executeWithLocale(ExecutionContext executionContext, + HttpServletRequest request, HttpServletResponse response) throws TaskExecutionException { try { final StaticGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( basicConfig, @@ -72,6 +75,25 @@ public class GenerateAustrianResidenceGuiTask extends AbstractLocaleAuthServletT PARAM_FORMWIZARDPOINT, pendingReq.getAuthUrl() + MsEidasNodeConstants.ENDPOINT_RESIDENCY_SEARCH); + + // inject flag to indicate advanced matching error + if (MatchingTaskUtils.getExecutionContextFlag( + executionContext, Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED)) { + 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()); + } + } + + // reset executionContext parameters + ReceiveOtherLoginMethodGuiResponseTask.ALL_EXECUTIONCONTEXT_PARAMETERS.forEach( + el -> executionContext.remove(el)); + guiBuilder.build(request, response, config, "Query Austrian residency"); } catch (final Exception e) { diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java index 11da4281..a90c5929 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/GenerateOtherLoginMethodGuiTask.java @@ -23,8 +23,6 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks; -import java.io.Serializable; - import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -34,6 +32,7 @@ import org.springframework.stereotype.Component; import at.asitplus.eidas.specific.core.MsEidasNodeConstants; import at.asitplus.eidas.specific.core.gui.StaticGuiBuilderConfiguration; import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants; +import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.MatchingTaskUtils; 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; @@ -62,8 +61,8 @@ public class GenerateOtherLoginMethodGuiTask extends AbstractLocaleAuthServletTa private IConfiguration basicConfig; @Override - public void executeWithLocale(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) - throws TaskExecutionException { + public void executeWithLocale(ExecutionContext executionContext, + HttpServletRequest request, HttpServletResponse response) throws TaskExecutionException { try { final StaticGuiBuilderConfiguration config = new StaticGuiBuilderConfiguration( basicConfig, @@ -75,7 +74,8 @@ public class GenerateOtherLoginMethodGuiTask extends AbstractLocaleAuthServletTa resourceLoader); // inject flag to indicate advanced matching error - if (getExecutionContextFlag(executionContext, Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED)) { + if (MatchingTaskUtils.getExecutionContextFlag( + executionContext, Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED)) { config.putCustomParameter(AbstractGuiFormBuilderConfiguration.PARAM_GROUP_UIOPTIONS, Constants.HTML_FORM_ADVANCED_MATCHING_FAILED, String.valueOf(true)); @@ -87,6 +87,13 @@ public class GenerateOtherLoginMethodGuiTask extends AbstractLocaleAuthServletTa } } + // inject request to create a new ERnP entry + config.putCustomParameter(AbstractGuiFormBuilderConfiguration.PARAM_GROUP_UIOPTIONS, + Constants.HTML_FORM_CREATE_NEW_ERNP_ENTRY, + String.valueOf( + MatchingTaskUtils.getExecutionContextFlag( + executionContext,Constants.TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK))); + // reset executionContext parameters ReceiveOtherLoginMethodGuiResponseTask.ALL_EXECUTIONCONTEXT_PARAMETERS.forEach( el -> executionContext.remove(el)); @@ -102,11 +109,4 @@ public class GenerateOtherLoginMethodGuiTask extends AbstractLocaleAuthServletTa } } - 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/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 89a3f350..f335bc2a 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 @@ -25,9 +25,11 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks; import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED; import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON; -import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK; +import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK; +import static at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants.TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK; import java.util.Enumeration; +import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -37,6 +39,8 @@ import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; import org.springframework.stereotype.Component; +import com.google.common.collect.Sets; + 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; @@ -83,13 +87,19 @@ import lombok.extern.slf4j.Slf4j; @Component("ReceiveAustrianResidenceGuiResponseTask") public class ReceiveAustrianResidenceGuiResponseTask extends AbstractLocaleAuthServletTask { - private static final String MSG_PROP_20 = "module.eidasauth.matching.20"; private static final String MSG_PROP_21 = "module.eidasauth.matching.21"; private static final String MSG_PROP_22 = "module.eidasauth.matching.22"; public static final String HTTP_PARAM_NO_RESIDENCE = "noResidence"; + public static final Set ALL_EXECUTIONCONTEXT_PARAMETERS = Sets.newHashSet( + CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, + CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON, + TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK, + TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK); + private final RegisterSearchService registerSearchService; + public ReceiveAustrianResidenceGuiResponseTask(RegisterSearchService registerSearchService) { this.registerSearchService = registerSearchService; @@ -104,21 +114,22 @@ public class ReceiveAustrianResidenceGuiResponseTask extends AbstractLocaleAuthS //return to AuswahlScreen if HTTP_PARAM_NO_RESIDENCE was selected final boolean forwardWithOutMandate = parseFlagFromHttpRequest(request, HTTP_PARAM_NO_RESIDENCE, false); if (forwardWithOutMandate) { - log.debug("User selects 'no residence' button. Switch back to 'other matching' selection ... "); - executionContext.put(TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK, true); - - executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON, MSG_PROP_20); - executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true); + log.debug("User selects 'no residence' button. Switch back to 'insert-into-ERnP' selection ... "); + executionContext.put(TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK, true); + executionContext.put(TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK, false); return; + } else { + executionContext.put(TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK, false); + } //load search parameters from HTML form AdresssucheOutput input = parseHtmlInput(request); if (validateHtmlInput(input)) { // HTML form should ensure that mandatory fields are set => this should never happen - log.warn("HTML form contains no residence information. Switch back to 'other matching' selection ... "); - executionContext.put(TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK, true); + log.warn("HTML form contains no residence information. Switch back to 'input residence inputs' ... "); + executionContext.put(TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK, true); executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON, MSG_PROP_21); executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true); @@ -136,9 +147,9 @@ public class ReceiveAustrianResidenceGuiResponseTask extends AbstractLocaleAuthS // validate matching response from registers if (residencyResult.getResultCount() != 1) { - log.info("Find {} match by using residence information. Forward user to 'other matching' selection ... ", + log.info("Find {} match by using residence information. Forward user to 'input residence infos' ... ", residencyResult.getResultCount() == 0 ? "no" : "more-than-one"); - executionContext.put(TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK, true); + executionContext.put(TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK, true); executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON, MSG_PROP_22); executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true); 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 ad641841..3c9db9ea 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 @@ -1,5 +1,6 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.utils; +import java.io.Serializable; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -20,6 +21,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData; import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.ICcSpecificEidProcessingService; import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.RegisterSearchService.RegisterStatusResults; import at.gv.egiz.eaaf.core.api.IRequest; +import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; import at.gv.egiz.eaaf.core.exceptions.EaafStorageException; import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper; import eu.eidas.auth.commons.attribute.AttributeDefinition; @@ -67,7 +69,7 @@ public class MatchingTaskUtils { RegisterStatusResults.class); } - + /** * Store intermediate matching result into session. * @@ -123,6 +125,21 @@ public class MatchingTaskUtils { } + + /** + * Evaluate a flag on Execution context. + * + * @param executionContext Current execution context. + * @param key Parameter name + * @return true if the parameter exists and evaluates to true, otherwise false + */ + public static boolean getExecutionContextFlag(ExecutionContext executionContext, String key) { + Serializable value = executionContext.get(key); + return value instanceof Boolean && (boolean)value + || value instanceof String && Boolean.parseBoolean((String) value); + + } + /** * Convert attributes from eIDAS Authn Response into a simple map, to be used from * {@link ICcSpecificEidProcessingService#postProcess(Map)}. diff --git a/modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml b/modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml index d72d6ac7..dfa8622c 100644 --- a/modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml +++ b/modules/authmodule-eIDAS-v2/src/main/resources/eIDAS.Authentication.process.xml @@ -67,9 +67,9 @@ - - + diff --git a/modules/authmodule-eIDAS-v2/src/main/resources/messages/eidas_connector_message.properties b/modules/authmodule-eIDAS-v2/src/main/resources/messages/eidas_connector_message.properties index 3942f30a..bd05fef2 100644 --- a/modules/authmodule-eIDAS-v2/src/main/resources/messages/eidas_connector_message.properties +++ b/modules/authmodule-eIDAS-v2/src/main/resources/messages/eidas_connector_message.properties @@ -22,8 +22,7 @@ module.eidasauth.matching.04=An error occurred while loading your data from offi module.eidasauth.matching.11=Matching failed, because of an ERnP communication error. Reason: {0} module.eidasauth.matching.12=Matching failed, because ERnP response contains historic information which is not supported. - -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 Austrian Identity was canceled. Use another method for matching or create a new Austrian identity. diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateAustrianResidenceGuiTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateAustrianResidenceGuiTaskTest.java index 539a41d2..1fc96e10 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateAustrianResidenceGuiTaskTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateAustrianResidenceGuiTaskTest.java @@ -26,6 +26,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; import com.fasterxml.jackson.databind.JsonNode; 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.tasks.GenerateAustrianResidenceGuiTask; import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException; import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl; @@ -93,6 +94,35 @@ public class GenerateAustrianResidenceGuiTaskTest { } + @Test + @SneakyThrows + public void jsonResponseWithError() throws TaskExecutionException, UnsupportedEncodingException { + httpReq.addHeader("Accept", "application/json"); + + String reason = RandomStringUtils.randomAlphabetic(5); + executionContext.put(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true); + executionContext.put(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON, reason); + + 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); + checkJsonElement(json, "wizardEndpoint", "https://localhost/ms_connector/residency/search"); + + 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 @SneakyThrows public void htmlResponse() throws TaskExecutionException, UnsupportedEncodingException { @@ -109,6 +139,29 @@ public class GenerateAustrianResidenceGuiTaskTest { } + @Test + @SneakyThrows + public void htmlResponseWithError() 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); + + task.execute(pendingReq, executionContext); + + //result validation + Assert.assertEquals("httpStausCode", 200, httpResp.getStatus()); + Assert.assertEquals("http ContentType", "text/html;charset=UTF-8", httpResp.getContentType()); + final String content = httpResp.getContentAsString(); + assertNotNull("response body is null", content); + Assert.assertFalse("response body is empty", content.isEmpty()); + assertTrue("no wizard endpoint", content.contains("https://localhost/ms_connector/residency/search")); + + Assert.assertTrue("missing errorfield", content.contains("
assertNull("executionContext parameter: " + el, executionContext.get(el))); - // remove pendingRequestId because it's added by default - executionContext.remove(EaafConstants.PROCESS_ENGINE_PENDINGREQUESTID); - + // remove pendingRequestId and changeLanguage because it's added by default + executionContext.remove(EaafConstants.PROCESS_ENGINE_PENDINGREQUESTID); + executionContext.remove("changeLanguage"); + // in case of 'ReceiveOtherLoginMethodGuiResponseTask.ALL_EXECUTIONCONTEXT_PARAMETERS' does not include all parameters assertTrue("ExecutionContext is not empty", executionContext.keySet().isEmpty()); } + + @Test + @SneakyThrows + public void jsonResponseInsertErnp() throws TaskExecutionException, UnsupportedEncodingException { + String reason = RandomStringUtils.randomAlphabetic(5); + executionContext.put(Constants.TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK, 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); + assertNull("advancedMatchFailed", json.get(Constants.HTML_FORM_ADVANCED_MATCHING_FAILED)); + assertNotNull("createNewErnpEntry", json.get(Constants.HTML_FORM_CREATE_NEW_ERNP_ENTRY)); + assertTrue("createNewErnpEntry", json.get(Constants.HTML_FORM_CREATE_NEW_ERNP_ENTRY).asBoolean()); + + assertNull("advancedMatchingFailedReason", json.get(Constants.HTML_FORM_ADVANCED_MATCHING_FAILED_REASON)); + + assertNotNull("pendingRequest not stored", + storage.getPendingRequest(pendingReq.getPendingRequestId())); + + } + @Test @SneakyThrows - public void jsonResponse() throws TaskExecutionException, UnsupportedEncodingException { + public void jsonResponseMathingFailed() 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); @@ -138,11 +169,33 @@ public class GenerateOtherLoginMethodGuiTaskTest { assertEquals("advancedMatchingFailedReason", reason, json.get(Constants.HTML_FORM_ADVANCED_MATCHING_FAILED_REASON).asText()); + assertNotNull("createNewErnpEntry", json.get(Constants.HTML_FORM_CREATE_NEW_ERNP_ENTRY)); + assertFalse("createNewErnpEntry", json.get(Constants.HTML_FORM_CREATE_NEW_ERNP_ENTRY).asBoolean()); + assertNotNull("pendingRequest not stored", storage.getPendingRequest(pendingReq.getPendingRequestId())); } + @Test + public void insertErnpRequested() throws TaskExecutionException, UnsupportedEncodingException { + executionContext.put(Constants.TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK, true); + + task.execute(pendingReq, executionContext); + + 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("No language selector with pendingRequestId", + html.contains("/otherLoginMethod?lang=en&pendingid=" + pendingReq.getPendingRequestId())); + Assert.assertTrue("Missing eIDAS infos", + html.contains(MessageFormat.format(TEST_PATTER_REQ_PARAM, SelectedLoginMethod.ADD_ME_AS_NEW))); + + } + @Test public void advancedMatchingFailedMsg() throws TaskExecutionException, UnsupportedEncodingException { executionContext.put(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true); @@ -150,7 +203,7 @@ public class GenerateOtherLoginMethodGuiTaskTest { task.execute(pendingReq, executionContext); String html = doBasicValidation(); - Assert.assertTrue("Missing eIDAS infos", + Assert.assertFalse("Missing eIDAS infos", html.contains(MessageFormat.format(TEST_PATTER_REQ_PARAM, SelectedLoginMethod.ADD_ME_AS_NEW))); Assert.assertTrue("missing errorfield", html.contains("
")); diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskRegisterTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskRegisterTest.java index 649fa48c..8d52baf3 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskRegisterTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskRegisterTest.java @@ -127,17 +127,17 @@ public class ReceiveAustrianResidenceGuiResponseTaskRegisterTest { @Test public void canceledByUser() throws Exception { - AdresssucheOutput userInput = setupUserInput(); - SimpleEidasData eidasData = setupEidasData(); RegisterStatusResults registerSearchResult = buildEmptyResult(); MatchingTaskUtils.storeIntermediateMatchingResult(pendingReq, registerSearchResult); httpReq.setParameter(ReceiveAustrianResidenceGuiResponseTask.HTTP_PARAM_NO_RESIDENCE, "true"); task.execute(pendingReq, executionContext); - assertEquals("Transition To S9", true, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK)); - assertEquals("matching failed flag", true, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED)); - assertEquals("failed reason", "module.eidasauth.matching.20", executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON)); + assertEquals("Transition To RequestInserErnp", true, + executionContext.get(Constants.TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK)); + assertEquals("Transition To AddressSearchForm", false, + executionContext.get(Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK)); + assertNull("matching failed flag", executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED)); assertNull("no final matching result", MatchingTaskUtils.getFinalMatchingResult(pendingReq)); } @@ -157,7 +157,9 @@ public class ReceiveAustrianResidenceGuiResponseTaskRegisterTest { task.execute(pendingReq, executionContext); // validate state - assertEquals("Transition To S9", true, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK)); + assertEquals("Transition To RequestInserErnp", false, executionContext.get(Constants.TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK)); + assertEquals("Transition To AddressSearchForm", true, + executionContext.get(Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK)); assertEquals("matching failed flag", true, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED)); assertEquals("failed reason", "module.eidasauth.matching.22", executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON)); assertNull("no final matching result", MatchingTaskUtils.getFinalMatchingResult(pendingReq)); diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java index ece0f16d..d7c0acc4 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAustrianResidenceGuiResponseTaskTest.java @@ -100,9 +100,11 @@ public class ReceiveAustrianResidenceGuiResponseTaskTest { task.execute(pendingReq, executionContext); - assertEquals("Transition To S9", true, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK)); - assertEquals("matching failed flag", true, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED)); - assertEquals("failed reason", "module.eidasauth.matching.20", executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON)); + assertEquals("Transition To RequestInserErnp", true, + executionContext.get(Constants.TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK)); + assertEquals("Transition To AddressSearchForm", false, + executionContext.get(Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK)); + assertNull("matching failed flag", executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED)); assertNull("no final matching result", MatchingTaskUtils.getFinalMatchingResult(pendingReq)); } @@ -114,7 +116,9 @@ public class ReceiveAustrianResidenceGuiResponseTaskTest { task.execute(pendingReq, executionContext); - assertEquals("Transition To S9", true, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK)); + assertEquals("Transition To RequestInserErnp", false, executionContext.get(Constants.TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK)); + assertEquals("Transition To AddressSearchForm", true, + executionContext.get(Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK)); assertEquals("matching failed flag", true, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED)); assertEquals("failed reason", "module.eidasauth.matching.21", executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON)); assertNull("no final matching result", MatchingTaskUtils.getFinalMatchingResult(pendingReq)); @@ -131,7 +135,9 @@ public class ReceiveAustrianResidenceGuiResponseTaskTest { task.execute(pendingReq, executionContext); - assertEquals("Transition To S9", true, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK)); + assertEquals("Transition To RequestInserErnp", false, executionContext.get(Constants.TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK)); + assertEquals("Transition To AddressSearchForm", true, + executionContext.get(Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK)); assertEquals("matching failed flag", true, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED)); assertEquals("failed reason", "module.eidasauth.matching.22", executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON)); assertNull("no final matching result", MatchingTaskUtils.getFinalMatchingResult(pendingReq)); @@ -189,7 +195,9 @@ public class ReceiveAustrianResidenceGuiResponseTaskTest { task.execute(pendingReq, executionContext); - assertEquals("Transition To S9", true, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK)); + assertEquals("Transition To RequestInserErnp", false, executionContext.get(Constants.TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK)); + assertEquals("Transition To AddressSearchForm", true, + executionContext.get(Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK)); assertEquals("matching failed flag", true, executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED)); assertEquals("failed reason", "module.eidasauth.matching.22", executionContext.get(Constants.CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON)); assertNull("no final matching result", MatchingTaskUtils.getFinalMatchingResult(pendingReq)); -- cgit v1.2.3 From 1cfd49dacd0ad5970b5c360d2c903b60244e587b Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 5 May 2022 18:23:16 +0200 Subject: test(ZMR/ERnP): disable two tests in register integration tests based on real registers operated by BM.I --- .../auth/eidas/v2/test/clients/ErnpRestClientProductionTest.java | 3 ++- .../modules/auth/eidas/v2/test/clients/ZmrClientProductionTest.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientProductionTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientProductionTest.java index fc0f7698..59cf4520 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientProductionTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ErnpRestClientProductionTest.java @@ -66,6 +66,7 @@ public class ErnpRestClientProductionTest { } + @Ignore @Test @SneakyThrows public void searchWithPersonalIdentifierSuccess() { @@ -117,7 +118,7 @@ public class ErnpRestClientProductionTest { } - + @Ignore @Test @SneakyThrows public void searchWithMdsSuccess() { diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientProductionTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientProductionTest.java index 97ea5bfa..b99bd302 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientProductionTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientProductionTest.java @@ -94,7 +94,7 @@ public class ZmrClientProductionTest { * Ignore this test because "javier", "Garcia", "1964-12-31", "EE" is used as test-identity * in test-country on vidp.gv.at. vidp.gv.at uses Test-SZR, but Test-SZR is connected to * Q-ZMR and Q-ERnP. There is a staging problem because this test uses T-ZMR and T-ERnP. - */ + */ @Ignore @Test public void searchWithMdsOnlyEidasIdentity() throws EidasSAuthenticationException { @@ -126,6 +126,7 @@ public class ZmrClientProductionTest { } + @Ignore @Test public void searchWithCountrySpecificsWithPersonalId() throws EidasSAuthenticationException { final ZmrRegisterResult result = client.searchCountrySpecific(null, -- cgit v1.2.3 From 332a953758ab2626095ae5bd0169ff2edd9adcae Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 12 May 2022 10:39:31 +0200 Subject: fix(matching): remove prefix from bPK aftern an ID Austria login --- .../ReceiveMobilePhoneSignatureResponseTask.java | 38 ++++++++++++---- .../v2/test/clients/ZmrClientProductionTest.java | 7 ++- ...eceiveMobilePhoneSignatureResponseTaskTest.java | 25 ++++++++++- .../Response_with_EID_deprecated_bpk_encoding.xml | 52 ++++++++++++++++++++++ 4 files changed, 109 insertions(+), 13 deletions(-) create mode 100644 modules/authmodule-eIDAS-v2/src/test/resources/data/Response_with_EID_deprecated_bpk_encoding.xml (limited to 'modules') 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 286b63b1..b212d133 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 @@ -127,7 +127,9 @@ public class ReceiveMobilePhoneSignatureResponseTask extends AbstractAuthServlet private static final String ERROR_MSG_01 = "Processing PVP response from 'ID Austria system' FAILED."; private static final String ERROR_MSG_02 = "PVP response decryption FAILED. No credential found."; private static final String ERROR_MSG_03 = "PVP response validation FAILED."; - + private static final String ERROR_GENERIC = "Matching failed, because response from ID Austria was " + + "invalid or contains an error. Detail: {}"; + private static final String MSG_PROP_23 = "module.eidasauth.matching.23"; private static final String MSG_PROP_24 = "module.eidasauth.matching.24"; @@ -155,6 +157,7 @@ public class ReceiveMobilePhoneSignatureResponseTask extends AbstractAuthServlet InboundMessage inboundMessage = decodeAndVerifyMessage(request, response, decoder, comparator); Pair processedMsg = validateAssertion((PvpSProfileResponse) inboundMessage); if (processedMsg.getSecond()) { + log.info("Matching failed, because ID Austria login was stopped by user."); // forward to next matching step in case of ID Autria authentication was stopped by user executionContext.put(TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK, true); executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON, MSG_PROP_23); @@ -177,6 +180,7 @@ public class ReceiveMobilePhoneSignatureResponseTask extends AbstractAuthServlet // check if MDS from ID Austria authentication matchs to eIDAS authentication if (!simpleMobileSignatureData.equalsSimpleEidasData(eidasData)) { + log.info("Matching failed, because MDS from ID-Austria login does not match to MDS from initial eIDAS"); executionContext.put(TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK, true); executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED_REASON, MSG_PROP_24); executionContext.put(CONTEXT_FLAG_ADVANCED_MATCHING_FAILED, true); @@ -207,28 +211,27 @@ public class ReceiveMobilePhoneSignatureResponseTask extends AbstractAuthServlet } } catch (final AuthnResponseValidationException e) { + log.info(ERROR_GENERIC, e.getMessage()); throw new TaskExecutionException(pendingReq, ERROR_MSG_03, e); } catch (MessageDecodingException | SecurityException | SamlSigningException e) { - //final String samlRequest = request.getParameter("SAMLRequest"); - //log.debug("Receive INVALID PVP Response from 'ms-specific eIDAS node': {}", - // samlRequest, null, e); + log.info(ERROR_GENERIC, e.getMessage()); throw new TaskExecutionException(pendingReq, ERROR_MSG_00, new AuthnResponseValidationException(ERROR_PVP_11, new Object[]{MODULE_NAME_FOR_LOGGING}, e)); } catch (IOException | MarshallingException | TransformerException e) { - log.debug("Processing PVP response from 'ms-specific eIDAS node' FAILED.", e); + log.info("Processing PVP response from 'ms-specific eIDAS node' FAILED.", e); throw new TaskExecutionException(pendingReq, ERROR_MSG_01, new AuthnResponseValidationException(ERROR_PVP_12, new Object[]{MODULE_NAME_FOR_LOGGING, e.getMessage()}, e)); } catch (final CredentialsNotAvailableException e) { - log.debug("PVP response decryption FAILED. No credential found.", e); + log.info("PVP response decryption FAILED. No credential found.", e); throw new TaskExecutionException(pendingReq, ERROR_MSG_02, new AuthnResponseValidationException(ERROR_PVP_10, new Object[]{MODULE_NAME_FOR_LOGGING}, e)); } catch (final Exception e) { // todo catch ManualFixNecessaryException in any other way? - log.debug("PVP response validation FAILED. Msg:" + e.getMessage(), e); + log.info("PVP response validation FAILED. Msg: {}",e.getMessage(), e); throw new TaskExecutionException(pendingReq, ERROR_MSG_03, new AuthnResponseValidationException(ERROR_PVP_12, new Object[]{MODULE_NAME_FOR_LOGGING, e.getMessage()}, e)); @@ -356,7 +359,7 @@ public class ReceiveMobilePhoneSignatureResponseTask extends AbstractAuthServlet final Set includedAttrNames = extractor.getAllIncludeAttributeNames(); for (final String attrName : includedAttrNames) { if (PvpAttributeDefinitions.BPK_NAME.equals(attrName)) { - builder.bpk(extractor.getSingleAttributeValue(attrName)); + builder.bpk(removeTargetPrefixFromBpk(extractor.getSingleAttributeValue(attrName))); } if (PvpAttributeDefinitions.GIVEN_NAME_NAME.equals(attrName)) { builder.givenName(extractor.getSingleAttributeValue(attrName)); @@ -377,5 +380,24 @@ public class ReceiveMobilePhoneSignatureResponseTask extends AbstractAuthServlet } + private String removeTargetPrefixFromBpk(String bpkWithPrefix) { + if (StringUtils.isNotEmpty(bpkWithPrefix)) { + final String[] spitted = bpkWithPrefix.split(":"); + if (spitted.length == 2) { + log.debug("Find PVP-Attr: {}", PvpAttributeDefinitions.BPK_FRIENDLY_NAME); + return spitted[1]; + + } else { + log.info("Find PVP-Attr: {} without prefix. Use it as it is", PvpAttributeDefinitions.BPK_FRIENDLY_NAME); + return spitted[0]; + + } + } else { + log.warn("Receive no bPK in response from ID Austria System. There is something wrong on IDA side!!!"); + return null; + + } + } + } diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientProductionTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientProductionTest.java index b99bd302..cada6f40 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientProductionTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientProductionTest.java @@ -197,7 +197,6 @@ public class ZmrClientProductionTest { } - @Ignore @Test public void updateZmrEntryTestIdentity() throws EidasSAuthenticationException { final String personalIdentifier = "7cEYSvKZasdfsafsaf4CDVzNT4E7cjkU4Vq"; @@ -205,9 +204,9 @@ public class ZmrClientProductionTest { final SimpleEidasData eidasData = SimpleEidasData.builder() .citizenCountryCode(cc) - .familyName("XXXĂ–hlinger") - .givenName("XXXHildegard") - .dateOfBirth("1971-02-18") + .familyName("Muster301") + .givenName("Eric") + .dateOfBirth("1988-01-03") .personalIdentifier(cc + "/AT/" + personalIdentifier) .pseudonym(personalIdentifier) .build(); diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveMobilePhoneSignatureResponseTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveMobilePhoneSignatureResponseTaskTest.java index 8fae81b1..034f06d1 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveMobilePhoneSignatureResponseTaskTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveMobilePhoneSignatureResponseTaskTest.java @@ -79,7 +79,7 @@ import net.shibboleth.utilities.java.support.xml.ParserPool; public class ReceiveMobilePhoneSignatureResponseTaskTest { private static final String METADATA_PATH = "classpath:/data/idp_metadata_classpath_entity.xml"; - private static final String BPK_FROM_ID_AUSTRIA = "BF:QVGm48cqcM4UcyhDTNGYmVdrIoY="; + private static final String BPK_FROM_ID_AUSTRIA = "QVGm48cqcM4UcyhDTNGYmVdrIoY="; @Autowired protected MsConnectorDummyConfigMap authConfig; @@ -377,6 +377,29 @@ public class ReceiveMobilePhoneSignatureResponseTaskTest { //Mockito.verify(registerSearchService).step7aKittProcess(eq(registerSearchResult), eq(eidData)); } + @Test + public void httpPostValidSignedAssertionEidValid_ExactlyOneRegisterResultDeprecadedBpkEnc() throws Exception { + setupMetadataResolver(); + initResponse("/data/Response_with_EID_deprecated_bpk_encoding.xml", true); + AuthProcessDataWrapper authProcessData = pendingReq.getSessionData(AuthProcessDataWrapper.class); + SimpleEidasData eidData = createEidasDataMatchingToSamlResponse().build(); + authProcessData.setGenericDataToSession(Constants.DATA_SIMPLE_EIDAS, eidData); + RegisterStatusResults registerSearchResult = buildResultWithOneMatch(); + MatchingTaskUtils.storeIntermediateMatchingResult(pendingReq, registerSearchResult); + + task.execute(pendingReq, executionContext); + + AuthProcessDataWrapper session = pendingReq.getSessionData(AuthProcessDataWrapper.class); + assertEquals("LoA", "http://eidas.europa.eu/LoA/low", session.getQaaLevel()); + assertEquals("IssueInstant", "2014-03-05T06:39:51Z", session.getIssueInstantString()); + assertNull("Transition To S16", executionContext.get(Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK)); + + //TODO: update this check because this task selects one result from MDS search result before and creates a new element + //Mockito.verify(registerSearchService).step7aKittProcess(eq(registerSearchResult), eq(eidData)); + } + + + //TODO: implement new test that this test makes no sense any more @Ignore @Test diff --git a/modules/authmodule-eIDAS-v2/src/test/resources/data/Response_with_EID_deprecated_bpk_encoding.xml b/modules/authmodule-eIDAS-v2/src/test/resources/data/Response_with_EID_deprecated_bpk_encoding.xml new file mode 100644 index 00000000..92ace06c --- /dev/null +++ b/modules/authmodule-eIDAS-v2/src/test/resources/data/Response_with_EID_deprecated_bpk_encoding.xml @@ -0,0 +1,52 @@ + + + classpath:/data/idp_metadata_classpath_entity.xml + + + + + https://demo.egiz.gv.at/demoportal_moaid-2.0/pvp/metadata + + QVGm48cqcM4UcyhDTNGYmVdrIoY= + + + + + + + https://localhost/authhandler/sp/idaustria/metadata + + + + + http://eidas.europa.eu/LoA/high + + + + + Mustermann + + + 2.1 + + + http://eidas.europa.eu/LoA/low + + + IT + + + Max + + + 1940-01-01 + + + QVGm48cqcM4UcyhDTNGYmVdrIoY= + + + MIIBbjCCARSgAwIBAgIEXh7TNzAKBggqhkjOPQQDAjA/MQswCQYDVQQGEwJBVDENMAsGA1UECgwERUdJWjEOMAwGA1UECwwFalVuaXQxETAPBgNVBAMMCG1ldGFkYXRhMB4XDTIwMDExNTA4NTQxNVoXDTMwMDExNDA4NTQxNVowPzELMAkGA1UEBhMCQVQxDTALBgNVBAoMBEVHSVoxDjAMBgNVBAsMBWpVbml0MREwDwYDVQQDDAhtZXRhZGF0YTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABBdBkaxt31p++aZeP3SmlWITj9SYO4McV2ccXFsH4X4QMHuKAMUvjxPm1kdU01eTOWdiQX0GpDIBspYMZh8ZKcwwCgYIKoZIzj0EAwIDSAAwRQIhAJ3QKlk9cd90s+i8y62fvmGF6LtfNO+JvkWqDUBeQImnAiA2KwFtzO7STAp9MEwQGe0vt0F8mO1ttrLE+rr6YxdwGA== + + + + -- cgit v1.2.3 From a988c0af75d96fdf03337b47a68b3a7876abfbac Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 12 May 2022 13:56:38 +0200 Subject: refact(ernp): change configuration keys for SSL keystore --- .../specific/modules/auth/eidas/v2/Constants.java | 23 ++++++++++++++++++++++ .../auth/eidas/v2/clients/ernp/ErnpRestClient.java | 12 +++++------ .../resources/config/junit_config_1.properties | 10 +++++----- .../config/junit_config_1_springboot.properties | 10 +++++----- 4 files changed, 39 insertions(+), 16 deletions(-) (limited to 'modules') 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 0b5d086d..588ea912 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 @@ -170,6 +170,29 @@ public class Constants { public static final String CONIG_PROPS_EIDAS_ERNPCLIENT = CONIG_PROPS_EIDAS_PREFIX + ".ernpclient"; public static final String CONIG_PROPS_EIDAS_ERNPCLIENT_ENDPOINT = CONIG_PROPS_EIDAS_ERNPCLIENT + ".endpoint"; + public static final String CONIG_PROPS_EIDAS_ERNPCLIENT_SSL_KEYSTORE_PATH = CONIG_PROPS_EIDAS_ERNPCLIENT + + ".ssl.keyStore.path"; + public static final String CONIG_PROPS_EIDAS_ERNPCLIENT_SSL_KEYSTORE_PASSWORD = CONIG_PROPS_EIDAS_ERNPCLIENT + + ".ssl.keyStore.password"; + public static final String CONIG_PROPS_EIDAS_ERNPCLIENT_SSL_KEYSTORE_TYPE = CONIG_PROPS_EIDAS_ERNPCLIENT + + ".ssl.keyStore.type"; + public static final String CONIG_PROPS_EIDAS_ERNPCLIENT_SSL_KEYSTORE_NAME = CONIG_PROPS_EIDAS_ERNPCLIENT + + ".ssl.keyStore.name"; + public static final String CONIG_PROPS_EIDAS_ERNPCLIENT_SSL_KEYS_ALIAS = CONIG_PROPS_EIDAS_ERNPCLIENT + + ".ssl.key.alias"; + public static final String CONIG_PROPS_EIDAS_ERNPCLIENT_SSL_KEY_PASSWORD = CONIG_PROPS_EIDAS_ERNPCLIENT + + ".ssl.key.password"; + public static final String CONIG_PROPS_EIDAS_ERNPCLIENT_SSL_TRUSTSTORE_PATH = CONIG_PROPS_EIDAS_ERNPCLIENT + + ".ssl.trustStore.path"; + public static final String CONIG_PROPS_EIDAS_ERNPCLIENT_SSL_TRUSTSTORE_PASSWORD = CONIG_PROPS_EIDAS_ERNPCLIENT + + ".ssl.trustStore.password"; + public static final String CONIG_PROPS_EIDAS_ERNPCLIENT_SSL_TRUSTSTORE_TYPE = CONIG_PROPS_EIDAS_ERNPCLIENT + + ".ssl.trustStore.type"; + public static final String CONIG_PROPS_EIDAS_ERNPCLIENT_SSL_TRUSTSTORE_NAME = CONIG_PROPS_EIDAS_ERNPCLIENT + + ".ssl.trustStore.name"; + + + public static final String CONIG_PROPS_EIDAS_ERNPCLIENT_TIMEOUT_CONNECTION = CONIG_PROPS_EIDAS_ERNPCLIENT + ".timeout.connection"; public static final String CONIG_PROPS_EIDAS_ERNPCLIENT_TIMEOUT_RESPONSE = CONIG_PROPS_EIDAS_ERNPCLIENT diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java index 4c4e3d87..6a732a0d 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/ernp/ErnpRestClient.java @@ -809,16 +809,16 @@ public class ErnpRestClient implements IErnpClient { // Set keystore configuration config.buildKeyStoreConfig( - basicConfig.getBasicConfiguration(Constants.CONIG_PROPS_EIDAS_COMMON_CLIENT_SSL_KEYSTORE_TYPE), - basicConfig.getBasicConfiguration(Constants.CONIG_PROPS_EIDAS_COMMON_CLIENT_SSL_KEYSTORE_PATH), - basicConfig.getBasicConfiguration(Constants.CONIG_PROPS_EIDAS_COMMON_CLIENT_SSL_KEYSTORE_PASSWORD), - basicConfig.getBasicConfiguration(Constants.CONIG_PROPS_EIDAS_COMMON_CLIENT_SSL_KEYSTORE_NAME)); + basicConfig.getBasicConfiguration(Constants.CONIG_PROPS_EIDAS_ERNPCLIENT_SSL_KEYSTORE_TYPE), + basicConfig.getBasicConfiguration(Constants.CONIG_PROPS_EIDAS_ERNPCLIENT_SSL_KEYSTORE_PATH), + basicConfig.getBasicConfiguration(Constants.CONIG_PROPS_EIDAS_ERNPCLIENT_SSL_KEYSTORE_PASSWORD), + basicConfig.getBasicConfiguration(Constants.CONIG_PROPS_EIDAS_ERNPCLIENT_SSL_KEYSTORE_NAME)); // Set key information config.setSslKeyAlias( - basicConfig.getBasicConfiguration(Constants.CONIG_PROPS_EIDAS_COMMON_CLIENT_SSL_KEYS_ALIAS)); + basicConfig.getBasicConfiguration(Constants.CONIG_PROPS_EIDAS_ERNPCLIENT_SSL_KEYS_ALIAS)); config.setSslKeyPassword( - basicConfig.getBasicConfiguration(Constants.CONIG_PROPS_EIDAS_COMMON_CLIENT_SSL_KEY_PASSWORD)); + basicConfig.getBasicConfiguration(Constants.CONIG_PROPS_EIDAS_ERNPCLIENT_SSL_KEY_PASSWORD)); // Set connection parameters // TODO: update EAAF-components to allow custom HTTP Connection-Timeouts diff --git a/modules/authmodule-eIDAS-v2/src/test/resources/config/junit_config_1.properties b/modules/authmodule-eIDAS-v2/src/test/resources/config/junit_config_1.properties index d84777f3..6d97513a 100644 --- a/modules/authmodule-eIDAS-v2/src/test/resources/config/junit_config_1.properties +++ b/modules/authmodule-eIDAS-v2/src/test/resources/config/junit_config_1.properties @@ -104,11 +104,11 @@ eidas.ms.auth.eIDAS.zmrclient.req.update.reason.code=EIDAS-KITT # ERnP communication eidas.ms.auth.eIDAS.ernpclient.endpoint=http://localhost:1718/demoernp eidas.ms.auth.eIDAS.ernpclient.req.organisation.behoerdennr=jUnit123456 -eidas.ms.auth.eIDAS.client.common.ssl.keyStore.type=jks -eidas.ms.auth.eIDAS.client.common.ssl.keyStore.path=../keystore/junit_test.jks -eidas.ms.auth.eIDAS.client.common.ssl.keyStore.password=password -eidas.ms.auth.eIDAS.client.common.ssl.key.alias=meta -eidas.ms.auth.eIDAS.client.common.ssl.key.password=password +eidas.ms.auth.eIDAS.ernpclient.ssl.keyStore.type=jks +eidas.ms.auth.eIDAS.ernpclient.ssl.keyStore.path=../keystore/junit_test.jks +eidas.ms.auth.eIDAS.ernpclient.ssl.keyStore.password=password +eidas.ms.auth.eIDAS.ernpclient.ssl.key.alias=meta +eidas.ms.auth.eIDAS.ernpclient.ssl.key.password=password diff --git a/modules/authmodule-eIDAS-v2/src/test/resources/config/junit_config_1_springboot.properties b/modules/authmodule-eIDAS-v2/src/test/resources/config/junit_config_1_springboot.properties index 0cc89a4a..22003513 100644 --- a/modules/authmodule-eIDAS-v2/src/test/resources/config/junit_config_1_springboot.properties +++ b/modules/authmodule-eIDAS-v2/src/test/resources/config/junit_config_1_springboot.properties @@ -60,11 +60,11 @@ eidas.ms.auth.eIDAS.zmrclient.req.update.reason.text=KITT for eIDAS Matching # ERnP communication eidas.ms.auth.eIDAS.ernpclient.endpoint=http://localhost:1718/demoernp eidas.ms.auth.eIDAS.ernpclient.req.organisation.behoerdennr=jUnit123456 -eidas.ms.auth.eIDAS.client.common.ssl.keyStore.type=jks -eidas.ms.auth.eIDAS.client.common.ssl.keyStore.path=../keystore/junit_test.jks -eidas.ms.auth.eIDAS.client.common.ssl.keyStore.password=password -eidas.ms.auth.eIDAS.client.common.ssl.key.alias=meta -eidas.ms.auth.eIDAS.client.common.ssl.key.password=password +eidas.ms.auth.eIDAS.ernpclient.ssl.keyStore.type=jks +eidas.ms.auth.eIDAS.ernpclient.ssl.keyStore.path=../keystore/junit_test.jks +eidas.ms.auth.eIDAS.ernpclient.ssl.keyStore.password=password +eidas.ms.auth.eIDAS.ernpclient.ssl.key.alias=meta +eidas.ms.auth.eIDAS.ernpclient.ssl.key.password=password -- cgit v1.2.3 From 1c8dc5ec1faf8efd931db79206d9696df91db459 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Thu, 12 May 2022 13:58:27 +0200 Subject: build(core): switch to next snapshot version --- modules/authmodule-eIDAS-v2/pom.xml | 2 +- modules/core_common_lib/pom.xml | 2 +- modules/core_common_webapp/pom.xml | 2 +- modules/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/authmodule-eIDAS-v2/pom.xml b/modules/authmodule-eIDAS-v2/pom.xml index be78cb76..2cb8d82e 100644 --- a/modules/authmodule-eIDAS-v2/pom.xml +++ b/modules/authmodule-eIDAS-v2/pom.xml @@ -6,7 +6,7 @@ at.asitplus.eidas.ms_specific modules - 1.2.5-SNAPSHOT + 1.3.0-SNAPSHOT at.asitplus.eidas.ms_specific.modules authmodule-eIDAS-v2 diff --git a/modules/core_common_lib/pom.xml b/modules/core_common_lib/pom.xml index e52216d3..8b06a9ee 100644 --- a/modules/core_common_lib/pom.xml +++ b/modules/core_common_lib/pom.xml @@ -7,7 +7,7 @@ at.asitplus.eidas.ms_specific modules - 1.2.5-SNAPSHOT + 1.3.0-SNAPSHOT core_common_lib ms_specific_common_lib diff --git a/modules/core_common_webapp/pom.xml b/modules/core_common_webapp/pom.xml index a7efdf15..a7090761 100644 --- a/modules/core_common_webapp/pom.xml +++ b/modules/core_common_webapp/pom.xml @@ -3,7 +3,7 @@ at.asitplus.eidas.ms_specific modules - 1.2.5-SNAPSHOT + 1.3.0-SNAPSHOT core_common_webapp WebApplication commons diff --git a/modules/pom.xml b/modules/pom.xml index fff02aa5..a6e9c696 100644 --- a/modules/pom.xml +++ b/modules/pom.xml @@ -4,7 +4,7 @@ at.asitplus.eidas ms_specific - 1.2.5-SNAPSHOT + 1.3.0-SNAPSHOT at.asitplus.eidas.ms_specific modules -- cgit v1.2.3