aboutsummaryrefslogtreecommitdiff
path: root/connector/src/test
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2022-03-03 15:27:30 +0000
committerThomas Lenz <thomas.lenz@egiz.gv.at>2022-03-03 15:27:30 +0000
commitd8247d4de494c176f78658fa2c0a38ac9ceab0aa (patch)
treed0b6bf2293b6e82282bfbab595e0b4d39fdb0428 /connector/src/test
parentb81ef7a782278cb941d3b424ccbe1ccc976c54f3 (diff)
parentc3bba97c9093eca911f6edd9cbb9742d5f32583c (diff)
downloadNational_eIDAS_Gateway-d8247d4de494c176f78658fa2c0a38ac9ceab0aa.tar.gz
National_eIDAS_Gateway-d8247d4de494c176f78658fa2c0a38ac9ceab0aa.tar.bz2
National_eIDAS_Gateway-d8247d4de494c176f78658fa2c0a38ac9ceab0aa.zip
Merge branch 'feature/matching_ernp_client' into 'feature/matching_base'
refactor(ernp): update openAPI specification from BM.I to use... See merge request egiz/eidas_at_proxy!16
Diffstat (limited to 'connector/src/test')
-rw-r--r--connector/src/test/java/at/asitplus/eidas/specific/connector/test/FullStartUpAndProcessTest.java34
-rw-r--r--connector/src/test/resources/config/junit_config_1_springboot.properties9
-rw-r--r--connector/src/test/resources/config/junit_config_2_springboot.properties9
3 files changed, 46 insertions, 6 deletions
diff --git a/connector/src/test/java/at/asitplus/eidas/specific/connector/test/FullStartUpAndProcessTest.java b/connector/src/test/java/at/asitplus/eidas/specific/connector/test/FullStartUpAndProcessTest.java
index 09d11a78..890d4b19 100644
--- a/connector/src/test/java/at/asitplus/eidas/specific/connector/test/FullStartUpAndProcessTest.java
+++ b/connector/src/test/java/at/asitplus/eidas/specific/connector/test/FullStartUpAndProcessTest.java
@@ -97,9 +97,12 @@ import eu.eidas.auth.commons.tx.BinaryLightToken;
import eu.eidas.specificcommunication.SpecificCommunicationDefinitionBeanNames;
import eu.eidas.specificcommunication.exception.SpecificCommunicationException;
import eu.eidas.specificcommunication.protocol.SpecificCommunicationService;
+import lombok.SneakyThrows;
import lombok.val;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.xml.XMLParserException;
+import okhttp3.mockwebserver.MockResponse;
+import okhttp3.mockwebserver.MockWebServer;
import szrservices.SZR;
import szrservices.SignContentEntry;
import szrservices.SignContentResponseType;
@@ -136,15 +139,20 @@ public class FullStartUpAndProcessTest {
private SZR szrMock;
private ServicePort zmrClient;
+ private static MockWebServer mockWebServer;
+
private String cc;
private String givenName;
private String familyName;
private String dateOfBirth;
private String personalId;
+ private String pseudonym;
private String vsz;
private String eidasBind;
+
+
/**
* jUnit class initializer.
* @throws InterruptedException In case of an error
@@ -153,7 +161,8 @@ public class FullStartUpAndProcessTest {
*
*/
@BeforeClass
- public static void classInitializer() throws InterruptedException, InitializationException, ComponentInitializationException {
+ @SneakyThrows
+ public static void classInitializer() {
final String current = new java.io.File(".").toURI().toString();
System.clearProperty("eidas.ms.configuration");
@@ -167,6 +176,10 @@ public class FullStartUpAndProcessTest {
EaafOpenSaml3xInitializer.eaafInitialize();
+ // start ERnP mockup WebServer
+ mockWebServer = new MockWebServer();
+ mockWebServer.start(1718);
+
}
/**
@@ -175,7 +188,8 @@ public class FullStartUpAndProcessTest {
* @throws Exception In case of an error
*/
@AfterClass
- public static void closeIgniteNode() throws Exception {
+ @SneakyThrows
+ public static void closeIgniteNode() {
System.out.println("Closiong Ignite Node ... ");
Ignition.stopAll(true);
@@ -183,6 +197,9 @@ public class FullStartUpAndProcessTest {
final Field field = IgniteInstanceInitializerSpecificCommunication.class.getDeclaredField("instance");
field.setAccessible(true);
field.set(null, null);
+
+ // shut-down ERnP mock-up WebServer
+ mockWebServer.shutdown();
}
@@ -210,7 +227,8 @@ public class FullStartUpAndProcessTest {
cc = RandomStringUtils.randomAlphabetic(2).toUpperCase();
- personalId = cc + "/AT/" + RandomStringUtils.randomNumeric(64);
+ pseudonym = RandomStringUtils.randomNumeric(64);
+ personalId = cc + "/AT/" + pseudonym;
familyName = RandomStringUtils.randomAlphabetic(10);
givenName = RandomStringUtils.randomAlphabetic(10);
dateOfBirth = "2015-10-12";
@@ -357,9 +375,13 @@ public class FullStartUpAndProcessTest {
RequestContextHolder.resetRequestAttributes();
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(eidasNodeRespReq, finalizeResp));
+ // inject ZMR, ERnP and SZR responses for matching
injectZmrResponse();
- injectSzrResponse();
-
+ injectSzrResponse();
+ mockWebServer.enqueue(new MockResponse().setResponseCode(200)
+ .setBody("{}") // empty response because we simulate result from ZMR
+ .setHeader("Content-Type", "application/json;charset=utf-8"));
+
//excute eIDAS node response
eidasSignal.restoreEidasAuthProcess(eidasNodeRespReq, finalizeResp);
@@ -454,7 +476,7 @@ public class FullStartUpAndProcessTest {
EidasIdentitaetErgebnisType eidasPersonalIdentifier = new EidasIdentitaetErgebnisType();
personInfo.getEidasIdentitaet().add(eidasPersonalIdentifier);
- eidasPersonalIdentifier.setEidasWert(personalId);
+ eidasPersonalIdentifier.setEidasWert(pseudonym);
eidasPersonalIdentifier.setEidasArt(Constants.eIDAS_ATTRURN_PERSONALIDENTIFIER);
eidasPersonalIdentifier.setStaatscode2(cc);
diff --git a/connector/src/test/resources/config/junit_config_1_springboot.properties b/connector/src/test/resources/config/junit_config_1_springboot.properties
index 3544c3a9..d3f0d136 100644
--- a/connector/src/test/resources/config/junit_config_1_springboot.properties
+++ b/connector/src/test/resources/config/junit_config_1_springboot.properties
@@ -55,6 +55,15 @@ eidas.ms.auth.eIDAS.zmrclient.ssl.trustStore.password=
eidas.ms.auth.eIDAS.zmrclient.req.organisation.behoerdennr=jUnit123456
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=keys/junit.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
+
## PVP2 S-Profile end-point configuration
diff --git a/connector/src/test/resources/config/junit_config_2_springboot.properties b/connector/src/test/resources/config/junit_config_2_springboot.properties
index a67e387f..71a573e0 100644
--- a/connector/src/test/resources/config/junit_config_2_springboot.properties
+++ b/connector/src/test/resources/config/junit_config_2_springboot.properties
@@ -55,6 +55,15 @@ eidas.ms.auth.eIDAS.zmrclient.ssl.trustStore.password=
eidas.ms.auth.eIDAS.zmrclient.req.organisation.behoerdennr=jUnit123456
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=keys/junit.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
+
## PVP2 S-Profile end-point configuration
eidas.ms.pvp2.keystore.type=jks