aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2/src/test
diff options
context:
space:
mode:
authorChristian Kollmann <christian.kollmann@a-sit.at>2021-01-12 16:08:36 +0100
committerChristian Kollmann <christian.kollmann@a-sit.at>2021-01-12 16:08:36 +0100
commit7961d920b67a4ce6cfb6bb9d9941242041bd47c6 (patch)
treeb7762944dc066ba19c59fbd452c58ef2cc57532c /eidas_modules/authmodule-eIDAS-v2/src/test
parent1247debcf4807dfdd9d9080d48f546c933a472b1 (diff)
parenteae2f7b06fc41741863d1ea6ec9c8b6da8a6b8fb (diff)
downloadNational_eIDAS_Gateway-7961d920b67a4ce6cfb6bb9d9941242041bd47c6.tar.gz
National_eIDAS_Gateway-7961d920b67a4ce6cfb6bb9d9941242041bd47c6.tar.bz2
National_eIDAS_Gateway-7961d920b67a4ce6cfb6bb9d9941242041bd47c6.zip
Personen Matching Part 1: Register Search
See merge request egiz/eidas_at_proxy!5
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/test')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/EidasRequestPreProcessingSecondTest.java2
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java460
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_tasks_test.xml17
3 files changed, 478 insertions, 1 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/EidasRequestPreProcessingSecondTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/EidasRequestPreProcessingSecondTest.java
index da7e3d85..e7bacded 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/EidasRequestPreProcessingSecondTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/EidasRequestPreProcessingSecondTest.java
@@ -107,7 +107,7 @@ public class EidasRequestPreProcessingSecondTest {
final LightRequest lightReq = authnRequestBuilder.build();
- Assert.assertEquals("ProviderName is not Static", "myNode", lightReq.getProviderName());
+ Assert.assertEquals("ProviderName is not Static", "myNode", lightReq.getProviderName());//Fixme "myNode"
Assert.assertEquals("no PublicSP", "public", lightReq.getSpType());
Assert.assertEquals("Requested attribute size not match", 8, lightReq.getRequestedAttributes().size());
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
new file mode 100644
index 00000000..9f58ba71
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskFirstTest.java
@@ -0,0 +1,460 @@
+/*
+ * Copyright 2020 A-SIT Plus GmbH
+ * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
+ * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "License");
+ * You may not use this work except in compliance with the License.
+ * You may obtain a copy of the License at:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.asitplus.eidas.specific.modules.auth.eidas.v2.test.tasks;
+
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp.IErnpClient;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.ManualFixNecessaryException;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.DeSpecificDetailSearchProcessor;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.ItSpecificDetailSearchProcessor;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.InitialSearchTask;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.IZmrClient;
+import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
+import at.gv.egiz.eaaf.core.exceptions.EaafStorageException;
+import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
+import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper;
+import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
+import at.gv.egiz.eaaf.core.impl.idp.process.ExecutionContextImpl;
+import eu.eidas.auth.commons.attribute.AttributeDefinition;
+import eu.eidas.auth.commons.attribute.ImmutableAttributeMap;
+import eu.eidas.auth.commons.attribute.PersonType;
+import eu.eidas.auth.commons.protocol.impl.AuthenticationResponse;
+import lombok.val;
+import org.apache.commons.lang3.RandomStringUtils;
+import org.jetbrains.annotations.NotNull;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.annotation.DirtiesContext.ClassMode;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.xml.namespace.QName;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Random;
+
+import static org.junit.Assert.assertThrows;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("/SpringTest-context_tasks_test.xml")
+@DirtiesContext(classMode = ClassMode.BEFORE_CLASS)
+public class InitialSearchTaskFirstTest {
+
+ private static final String DE_ST = "de/st/";
+ private static final String IT_ST = "it/st/";
+
+ private InitialSearchTask task;
+ @Mock
+ private IZmrClient zmrClient;
+ @Mock
+ private IErnpClient ernpClient;
+
+ final ExecutionContext executionContext = new ExecutionContextImpl();
+ private TestRequestImpl pendingReq;
+ private final String randomBpk = RandomStringUtils.randomNumeric(6);
+ private final String randomIdentifier = RandomStringUtils.randomNumeric(10);
+ private final String randomPseudonym = DE_ST + randomIdentifier;
+ private final String randomFamilyName = RandomStringUtils.randomAlphabetic(10);
+ private final String randomGivenName = RandomStringUtils.randomAlphabetic(10);
+ private final String randomPlaceOfBirth = RandomStringUtils.randomAlphabetic(10);
+ private final String randomBirthName = RandomStringUtils.randomAlphabetic(10);
+ private final String randomDate = "2011-01-" + (10 + new Random().nextInt(18));
+
+ /**
+ * jUnit class initializer.
+ *
+ * @throws IOException In case of an error
+ */
+ @BeforeClass
+ public static void classInitializer() throws IOException {
+ final String current = new java.io.File(".").toURI().toString();
+ System.setProperty("eidas.ms.configuration", current
+ + "src/test/resources/config/junit_config_1.properties");
+ }
+
+ /**
+ * jUnit test set-up.
+ */
+ @Before
+ public void setUp() throws URISyntaxException, EaafStorageException {
+ MockitoAnnotations.initMocks(this);
+ task = new InitialSearchTask(new ArrayList<>(), ernpClient, zmrClient);
+
+ MockHttpServletRequest httpReq = new MockHttpServletRequest("POST", "https://localhost/authhandler");
+ MockHttpServletResponse httpResp = new MockHttpServletResponse();
+ RequestContextHolder.resetRequestAttributes();
+ RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(httpReq, httpResp));
+
+ final AuthenticationResponse response = buildDummyAuthResponseRandomPerson();
+ pendingReq = new TestRequestImpl();
+ pendingReq.getSessionData(AuthProcessDataWrapper.class)
+ .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
+ }
+
+ /**
+ * One match, but register update needed
+ */
+ @Test
+ @DirtiesContext
+ public void testNode100_UserIdentifiedUpdateNecessary_a() throws Exception {
+ String newFirstName = RandomStringUtils.randomAlphabetic(10);
+ Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.singletonList(
+ new RegisterResult(randomBpk, randomPseudonym, newFirstName, randomFamilyName, randomDate)));
+ Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
+
+ task.execute(pendingReq, executionContext);
+ String bPk = (String)
+ pendingReq.getSessionData(AuthProcessDataWrapper.class)
+ .getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+
+ Assert.assertEquals("Wrong bpk", bPk, randomBpk);
+ }
+
+ /**
+ * One match, but register update needed
+ */
+ @Test
+ @DirtiesContext
+ public void testNode100_UserIdentifiedUpdateNecessary_b() throws TaskExecutionException {
+ Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
+ String newRandomGivenName = RandomStringUtils.randomAlphabetic(10);
+ Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.singletonList(
+ new RegisterResult(randomBpk, randomPseudonym, newRandomGivenName, randomFamilyName, randomDate)));
+
+ task.execute(pendingReq, executionContext);
+ String bPk = (String)
+ pendingReq.getSessionData(AuthProcessDataWrapper.class)
+ .getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+
+ Assert.assertEquals("Wrong bpk", bPk, randomBpk);
+ }
+
+ /**
+ * Two matches found in ZMR
+ */
+ @Test
+ @DirtiesContext
+ public void testNode101_ManualFixNecessary_a() {
+ ArrayList<RegisterResult> zmrResult = new ArrayList<>();
+ zmrResult.add(new RegisterResult(randomBpk, randomPseudonym, randomGivenName, randomFamilyName, randomDate));
+ String newRandomGivenName = randomGivenName + RandomStringUtils.randomAlphabetic(2);
+ zmrResult.add(new RegisterResult(randomBpk, randomPseudonym, newRandomGivenName, randomFamilyName, randomDate));
+ Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(zmrResult);
+ Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
+
+ TaskExecutionException exception = assertThrows(TaskExecutionException.class,
+ () -> task.execute(pendingReq, executionContext));
+
+ Throwable origE = exception.getOriginalException();
+ Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
+ }
+
+
+ /**
+ * Two matches found in ErnP
+ */
+ @Test
+ @DirtiesContext
+ public void testNode101_ManualFixNecessary_b() {
+ Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
+ ArrayList<RegisterResult> ernpResult = new ArrayList<>();
+ ernpResult.add(new RegisterResult(randomBpk, randomPseudonym, randomGivenName, randomFamilyName, randomDate));
+ String newRandomGivenName = randomGivenName + RandomStringUtils.randomAlphabetic(2);
+ ernpResult.add(
+ new RegisterResult(randomBpk, randomPseudonym, newRandomGivenName, randomFamilyName, randomDate));
+ Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(ernpResult);
+
+ TaskExecutionException exception = assertThrows(TaskExecutionException.class,
+ () -> task.execute(pendingReq, executionContext));
+
+ Throwable origE = exception.getOriginalException();
+ Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
+ }
+
+ /**
+ * One match, no register update needed
+ */
+ @Test
+ @DirtiesContext
+ public void testNode102_UserIdentified_a() throws Exception {
+ Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
+ Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.singletonList(
+ new RegisterResult(randomBpk, randomPseudonym, randomGivenName, randomFamilyName, randomDate)));
+
+ task.execute(pendingReq, executionContext);
+ String bPk = (String)
+ pendingReq.getSessionData(AuthProcessDataWrapper.class)
+ .getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+ Assert.assertEquals("Wrong bpk", bPk, randomBpk);
+ }
+
+ /**
+ * One match, no register update needed
+ */
+ @Test
+ @DirtiesContext
+ public void testNode102_UserIdentified_b() throws Exception {
+ Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.singletonList(
+ new RegisterResult(randomBpk, randomPseudonym, randomGivenName, randomFamilyName, randomDate)));
+ Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
+
+ task.execute(pendingReq, executionContext);
+
+ String bPk = (String)
+ pendingReq.getSessionData(AuthProcessDataWrapper.class)
+ .getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+ Assert.assertEquals("Wrong bpk", bPk, randomBpk);
+ }
+
+ /**
+ * One match found in ZMR and ErnP with detail search
+ */
+ @Test
+ @DirtiesContext
+ public void testNode103_UserIdentified_IT() throws Exception {
+ String taxNumber = RandomStringUtils.randomNumeric(14);
+ final AuthenticationResponse response = buildDummyAuthResponseRandomPersonIT_Tax(taxNumber);
+ TestRequestImpl pendingReq1 = new TestRequestImpl();
+ pendingReq1.getSessionData(AuthProcessDataWrapper.class)
+ .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
+ Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
+ String newRandomPseudonym = IT_ST + randomIdentifier + RandomStringUtils.randomNumeric(2);
+ Mockito.when(zmrClient.searchItSpecific(taxNumber)).thenReturn(Collections.singletonList(
+ new RegisterResult(randomBpk, newRandomPseudonym, randomGivenName, randomFamilyName,
+ randomDate, null, null, taxNumber, null)));
+ Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
+ task = new InitialSearchTask(
+ Collections.singletonList(new ItSpecificDetailSearchProcessor(ernpClient, zmrClient)),
+ ernpClient, zmrClient);
+
+ task.execute(pendingReq1, executionContext);
+
+ String bPk = (String)
+ pendingReq1.getSessionData(AuthProcessDataWrapper.class)
+ .getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+ Assert.assertEquals("Wrong bpk", bPk, randomBpk);
+ }
+
+ /**
+ * Multiple matches found in ZMR and ErnP with detail search
+ */
+ @Test
+ @DirtiesContext
+ public void testNode103_UserIdentified_DE() throws Exception {
+ final AuthenticationResponse response = buildDummyAuthResponseDE(randomGivenName, randomFamilyName,
+ randomPseudonym,
+ randomDate, randomPlaceOfBirth, randomBirthName);
+ TestRequestImpl pendingReq1 = new TestRequestImpl();
+ pendingReq1.getSessionData(AuthProcessDataWrapper.class)
+ .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
+ Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
+ Mockito.when(zmrClient.searchDeSpecific(randomGivenName, randomFamilyName, randomDate, randomPlaceOfBirth,
+ randomBirthName))
+ .thenReturn(Collections.singletonList(new RegisterResult(randomBpk, randomPseudonym, randomGivenName,
+ randomFamilyName, randomDate, randomPlaceOfBirth, randomBirthName, null, null)));
+ Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
+ task = new InitialSearchTask(
+ Collections.singletonList(new DeSpecificDetailSearchProcessor(ernpClient, zmrClient)),
+ ernpClient, zmrClient);
+
+ task.execute(pendingReq1, executionContext);
+
+ String resultBpk = (String)
+ pendingReq1.getSessionData(AuthProcessDataWrapper.class)
+ .getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+ Assert.assertEquals("Wrong bpk", resultBpk, randomBpk);
+ }
+
+ /**
+ * Multiple matches found in ZMR and ErnP with detail search
+ */
+ @Test
+ @DirtiesContext
+ public void testNode104_ManualFixNecessary_DE() throws Exception {
+ String newRandomPseudonym = randomPseudonym + RandomStringUtils.randomNumeric(2);
+ String newRandomBpk = randomBpk + RandomStringUtils.randomNumeric(6);
+ final AuthenticationResponse response = buildDummyAuthResponseDE(randomGivenName, randomFamilyName,
+ randomPseudonym,
+ randomDate, randomPlaceOfBirth, randomBirthName);
+ TestRequestImpl pendingReq1 = new TestRequestImpl();
+ pendingReq1.getSessionData(AuthProcessDataWrapper.class)
+ .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
+ Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
+ ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
+ zmrResultSpecific.add(
+ new RegisterResult(randomBpk, randomPseudonym, randomGivenName, randomFamilyName, randomDate,
+ randomPlaceOfBirth, randomBirthName, null, null));
+ zmrResultSpecific.add(new RegisterResult(newRandomBpk, newRandomPseudonym, randomGivenName, randomFamilyName, randomDate,
+ randomPlaceOfBirth, randomBirthName, null, null));
+ Mockito.when(zmrClient.searchDeSpecific(randomGivenName, randomFamilyName, randomDate, randomPlaceOfBirth,
+ randomBirthName)).thenReturn(zmrResultSpecific);
+ Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
+ task = new InitialSearchTask(
+ Collections.singletonList(new DeSpecificDetailSearchProcessor(ernpClient, zmrClient)),
+ ernpClient, zmrClient);
+
+ TaskExecutionException exception = assertThrows(TaskExecutionException.class,
+ () -> task.execute(pendingReq1, executionContext));
+
+ Throwable origE = exception.getOriginalException();
+ Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
+ }
+
+ /**
+ * Multiple matches found in ZMR and ErnP with detail search
+ */
+ @Test
+ @DirtiesContext
+ public void testNode104_ManualFixNecessary_IT() throws Exception {
+ String randomTaxNumber = RandomStringUtils.randomNumeric(14);
+ final AuthenticationResponse response = buildDummyAuthResponseRandomPersonIT_Tax(randomTaxNumber);
+ TestRequestImpl pendingReq1 = new TestRequestImpl();
+ pendingReq1.getSessionData(AuthProcessDataWrapper.class)
+ .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response);
+ Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
+ ArrayList<RegisterResult> zmrResultSpecific = new ArrayList<>();
+ String randomPseudonym = IT_ST + randomIdentifier + "4";
+ zmrResultSpecific.add(new RegisterResult(randomBpk, randomPseudonym, randomGivenName,
+ randomFamilyName, randomDate, null, null, randomTaxNumber, null));
+ String newRandomPseudonym = IT_ST + randomIdentifier + "5";
+ String newRandomBpk = RandomStringUtils.randomNumeric(6);
+ zmrResultSpecific.add(new RegisterResult(newRandomBpk, newRandomPseudonym, randomGivenName,
+ randomFamilyName, randomDate, null, null, randomTaxNumber, null));
+ Mockito.when(zmrClient.searchItSpecific(randomTaxNumber)).thenReturn(zmrResultSpecific);
+ Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
+ task = new InitialSearchTask(
+ Collections.singletonList(new ItSpecificDetailSearchProcessor(ernpClient, zmrClient)),
+ ernpClient, zmrClient);
+
+ TaskExecutionException exception = assertThrows(TaskExecutionException.class,
+ () -> task.execute(pendingReq1, executionContext));
+
+ Throwable origE = exception.getOriginalException();
+ Assert.assertTrue("Wrong exception", (origE.getCause() instanceof ManualFixNecessaryException));
+ }
+
+ /**
+ * NO match found in ZMR and ErnP with Initial search
+ */
+ @Test
+ @DirtiesContext
+ public void testNode105_TemporaryEnd() throws TaskExecutionException {
+ Mockito.when(zmrClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
+ Mockito.when(ernpClient.searchWithPersonIdentifier(randomIdentifier)).thenReturn(Collections.emptyList());
+
+ task.execute(pendingReq, executionContext);
+
+ String bPk = (String)
+ pendingReq.getSessionData(AuthProcessDataWrapper.class)
+ .getGenericDataFromSession(Constants.DATA_RESULT_MATCHING_BPK);
+ Assert.assertEquals("Wrong bpk", "TODO-Temporary-Endnode-105", bPk);
+ }
+
+
+ @NotNull
+ private AuthenticationResponse buildDummyAuthResponseRandomPerson() throws URISyntaxException {
+ return buildDummyAuthResponse(randomGivenName, randomFamilyName, DE_ST + randomIdentifier, randomDate);
+ }
+
+ private AuthenticationResponse buildDummyAuthResponseRandomPersonIT_Tax(String taxNumber)
+ throws URISyntaxException {
+ return buildDummyAuthResponse(randomGivenName, randomFamilyName, IT_ST + randomIdentifier, randomDate,
+ taxNumber, null, null);
+ }
+
+ @NotNull
+ private AuthenticationResponse buildDummyAuthResponse(String givenName, String familyName, String identifier,
+ String dateOfBirth) throws URISyntaxException {
+ return buildDummyAuthResponse(givenName, familyName, identifier, dateOfBirth, null, null, null);
+ }
+
+ @NotNull
+ private AuthenticationResponse buildDummyAuthResponseDE(String givenName, String familyName, String identifier,
+ String dateOfBirth, String placeOfBirth,
+ String birthName) throws URISyntaxException {
+ return buildDummyAuthResponse(givenName, familyName, identifier, dateOfBirth, null, placeOfBirth, birthName);
+ }
+
+ @NotNull
+ private AuthenticationResponse buildDummyAuthResponse(String givenName, String familyName, String identifier,
+ String dateOfBirth, String taxNumber, String placeOfBirth,
+ String birthName) throws URISyntaxException {
+ ImmutableAttributeMap.Builder builder = ImmutableAttributeMap.builder()
+ .put(generateStringAttribute(Constants.eIDAS_ATTR_PERSONALIDENTIFIER, "ff", "af"), identifier)
+ .put(generateStringAttribute(Constants.eIDAS_ATTR_CURRENTFAMILYNAME, "fff", "aff"), familyName)
+ .put(generateStringAttribute(Constants.eIDAS_ATTR_CURRENTGIVENNAME, "ffff", "afff"), givenName)
+ .put(generateDateTimeAttribute(Constants.eIDAS_ATTR_DATEOFBIRTH, "fffff", "affff"), dateOfBirth);
+ if (taxNumber != null) {
+ builder.put(generateStringAttribute(Constants.eIDAS_ATTR_TAXREFERENCE, "ffffff", "afffff"), taxNumber);
+ }
+ if (birthName != null) {
+ builder.put(generateStringAttribute(Constants.eIDAS_ATTR_BIRTHNAME, "fffffff", "affffff"), birthName);
+ }
+ if (placeOfBirth != null) {
+ builder.put(generateStringAttribute(Constants.eIDAS_ATTR_PLACEOFBIRTH, "ffffffff", "afffffff"),
+ placeOfBirth);
+ }
+ final ImmutableAttributeMap attributeMap = builder.build();
+
+ val b = new AuthenticationResponse.Builder();
+ return b.id("aasdf").issuer("asd").subject("asf").statusCode("200").inResponseTo("asdf").subjectNameIdFormat(
+ "afaf").attributes(attributeMap).build();
+ }
+
+ private AttributeDefinition<Object> generateStringAttribute(String friendlyName, String fragment, String prefix)
+ throws URISyntaxException {
+ return generateAttribute(friendlyName, fragment, prefix, "eu.eidas.auth.commons.attribute.impl" +
+ ".LiteralStringAttributeValueMarshaller");
+ }
+
+ private AttributeDefinition<Object> generateDateTimeAttribute(String friendlyName, String fragment, String prefix)
+ throws URISyntaxException {
+ return generateAttribute(friendlyName, fragment, prefix, "eu.eidas.auth.commons.attribute.impl" +
+ ".DateTimeAttributeValueMarshaller");
+ }
+
+ private AttributeDefinition<Object> generateAttribute(String friendlyName, String fragment, String prefix,
+ String marshaller) throws URISyntaxException {
+ return AttributeDefinition.builder()
+ .friendlyName(friendlyName).nameUri(new URI("ad", "sd", fragment))
+ .personType(PersonType.LEGAL_PERSON).xmlType(new QName("http://saf", "as", prefix))
+ .attributeValueMarshaller(marshaller).build();
+ }
+
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_tasks_test.xml b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_tasks_test.xml
index 7d5a4c53..1f3a984b 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_tasks_test.xml
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_tasks_test.xml
@@ -61,4 +61,21 @@
class="at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.CreateIdentityLinkTask"
scope="prototype" />
+ <bean id="InitialSearchTask"
+ class="at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.InitialSearchTask"
+ scope="prototype" />
+
+ <bean id="ErnbClientForeIDAS"
+ class="at.asitplus.eidas.specific.modules.auth.eidas.v2.ernp.DummyErnpClient" />
+
+ <bean id="ZmrClientForeIDAS"
+ class="at.asitplus.eidas.specific.modules.auth.eidas.v2.zmr.DummyZmrClient" />
+
+ <bean id="DE-Specific-Search"
+ class="at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.DeSpecificDetailSearchProcessor">
+ </bean>
+
+ <bean id="IT-Specific-Search"
+ class="at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.ItSpecificDetailSearchProcessor">
+ </bean>
</beans> \ No newline at end of file