aboutsummaryrefslogtreecommitdiff
path: root/modules/eidas_proxy-sevice/src/test
diff options
context:
space:
mode:
authorThomas <>2022-12-01 08:21:51 +0100
committerThomas <>2022-12-01 08:21:51 +0100
commit709244c42e6dfe339805a1476a70a5690b1ee4dc (patch)
treeaa80c206912e03a3452d61ffbffc694c87d24504 /modules/eidas_proxy-sevice/src/test
parent0847c9ecc75ccd5d38d09e96c6d09c8326d6a7e5 (diff)
downloadNational_eIDAS_Gateway-709244c42e6dfe339805a1476a70a5690b1ee4dc.tar.gz
National_eIDAS_Gateway-709244c42e6dfe339805a1476a70a5690b1ee4dc.tar.bz2
National_eIDAS_Gateway-709244c42e6dfe339805a1476a70a5690b1ee4dc.zip
feat(proxyservice): add configuration flag to disable error forwarding to eIDAS Node
Diffstat (limited to 'modules/eidas_proxy-sevice/src/test')
-rw-r--r--modules/eidas_proxy-sevice/src/test/java/at/asitplus/eidas/specific/modules/msproxyservice/test/protocol/EidasProxyServiceControllerTest.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/modules/eidas_proxy-sevice/src/test/java/at/asitplus/eidas/specific/modules/msproxyservice/test/protocol/EidasProxyServiceControllerTest.java b/modules/eidas_proxy-sevice/src/test/java/at/asitplus/eidas/specific/modules/msproxyservice/test/protocol/EidasProxyServiceControllerTest.java
index 5894ea45..c23f1d53 100644
--- a/modules/eidas_proxy-sevice/src/test/java/at/asitplus/eidas/specific/modules/msproxyservice/test/protocol/EidasProxyServiceControllerTest.java
+++ b/modules/eidas_proxy-sevice/src/test/java/at/asitplus/eidas/specific/modules/msproxyservice/test/protocol/EidasProxyServiceControllerTest.java
@@ -93,6 +93,7 @@ public class EidasProxyServiceControllerTest {
config.putConfigValue("eidas.ms.auth.eIDAS.node_v2.proxy.forward.endpoint",
"http://eidas.proxy/endpoint");
+ config.putConfigValue("eidas.ms.auth.eIDAS.node_v2.proxy.forward.errors", "true");
springManagedSpecificConnectorCommunicationService =
(SpecificCommunicationService) context.getBean(
@@ -155,6 +156,33 @@ public class EidasProxyServiceControllerTest {
}
@Test
+ public void generateErrorResponseWithoutForward() throws Throwable {
+ config.putConfigValue("eidas.ms.auth.eIDAS.node_v2.proxy.forward.errors", "false");
+
+ ProxyServicePendingRequest pendingReq = new ProxyServicePendingRequest();
+ pendingReq.initialize(httpReq, config);
+
+ LightRequest.Builder eidasRequestBuilder = LightRequest.builder()
+ .id(UUID.randomUUID().toString())
+ .issuer(RandomStringUtils.randomAlphabetic(10))
+ .citizenCountryCode(RandomStringUtils.randomAlphabetic(2).toUpperCase())
+ .levelOfAssurance(EaafConstants.EIDAS_LOA_HIGH)
+ .spCountryCode(RandomStringUtils.randomAlphabetic(2).toUpperCase())
+ .spType("public")
+ .requesterId(RandomStringUtils.randomAlphanumeric(10))
+ .providerName(RandomStringUtils.randomAlphanumeric(10));
+ pendingReq.setEidasRequest(eidasRequestBuilder.build());
+
+
+ // execute test
+ Assert.assertFalse("wrong statusCode", controller.generateErrorMessage(
+ new EaafException("1000"),
+ httpReq, httpResp,
+ pendingReq));
+
+ }
+
+ @Test
public void missingEidasToken() {
EidasProxyServiceException exception = assertThrows(EidasProxyServiceException.class,
() -> controller.receiveEidasAuthnRequest(httpReq, httpResp));