From a19b85723223dbefff7f34a59421c2d2edf3261f Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Wed, 1 Apr 2020 23:17:27 +0200 Subject: update process-engine support HTTP POST and GET error forwarting. This is needed for processes in IFrames --- .../gui/DummyGuiBuilderConfigurationFactory.java | 14 ++++++++++++-- .../impl/idp/module/test/DummyProtocolAuthService.java | 18 ++++++++++++++++++ .../core/impl/idp/module/test/TestRequestImpl.java | 18 +++++++++++++++--- 3 files changed, 45 insertions(+), 5 deletions(-) (limited to 'eaaf_core/src/test') diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/gui/DummyGuiBuilderConfigurationFactory.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/gui/DummyGuiBuilderConfigurationFactory.java index be71a29c..570c3dd2 100644 --- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/gui/DummyGuiBuilderConfigurationFactory.java +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/gui/DummyGuiBuilderConfigurationFactory.java @@ -11,13 +11,20 @@ import at.gv.egiz.eaaf.core.api.gui.IVelocityGuiBuilderConfiguration; public class DummyGuiBuilderConfigurationFactory implements IGuiBuilderConfigurationFactory { private IGuiBuilderConfiguration errorGuiConfig; + private IGuiBuilderConfiguration parentHopGuiConfig; private IVelocityGuiBuilderConfiguration velocityBuilderConfig; @Override public IGuiBuilderConfiguration getDefaultErrorGui(String authUrl) { return errorGuiConfig; } - + + @Override + public IGuiBuilderConfiguration getDefaultIFrameParentHopGui(IRequest pendingReq, String endpoint, + String errorKey) { + return parentHopGuiConfig; + } + @Override public IVelocityGuiBuilderConfiguration getSpSpecificSaml2PostConfiguration(IRequest pendingReq, String viewName, URI configRootContextDir) throws MalformedURLException { @@ -28,9 +35,12 @@ public class DummyGuiBuilderConfigurationFactory implements IGuiBuilderConfigura this.errorGuiConfig = errorGuiConfig; } + public void setDefaultIFrameParentHopGui(IGuiBuilderConfiguration guiConfig) { + this.parentHopGuiConfig = guiConfig; + } + public void setVelocityBuilderConfig(IVelocityGuiBuilderConfiguration velocityBuilderConfig) { this.velocityBuilderConfig = velocityBuilderConfig; } - } diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyProtocolAuthService.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyProtocolAuthService.java index 300a390d..4b07bea9 100644 --- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyProtocolAuthService.java +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/DummyProtocolAuthService.java @@ -8,6 +8,9 @@ import javax.servlet.http.HttpServletResponse; import at.gv.egiz.eaaf.core.api.IRequest; import at.gv.egiz.eaaf.core.api.idp.auth.services.IProtocolAuthenticationService; import at.gv.egiz.eaaf.core.exceptions.EaafException; +import at.gv.egiz.eaaf.core.exceptions.GuiBuildException; +import at.gv.egiz.eaaf.core.impl.data.Pair; +import lombok.Getter; public class DummyProtocolAuthService implements IProtocolAuthenticationService { @@ -16,6 +19,9 @@ public class DummyProtocolAuthService implements IProtocolAuthenticationService private HttpServletResponse httpResp; private Throwable exception; private boolean writeToStatisticLog; + + @Getter + private String errorKey; @Override public void performAuthentication(final HttpServletRequest req, final HttpServletResponse resp, @@ -57,6 +63,18 @@ public class DummyProtocolAuthService implements IProtocolAuthenticationService } + @Override + public void forwardToErrorHandler(Pair errorToHandle, String errorKey, + HttpServletRequest req, HttpServletResponse resp) throws GuiBuildException { + this.httpReq = req; + this.httpResp = resp; + this.pendingReq = errorToHandle.getFirst(); + this.exception = errorToHandle.getSecond(); + this.errorKey = errorKey; + + + } + public IRequest getPendingReq() { return pendingReq; } diff --git a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/TestRequestImpl.java b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/TestRequestImpl.java index 8f8f8114..b3f733d1 100644 --- a/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/TestRequestImpl.java +++ b/eaaf_core/src/test/java/at/gv/egiz/eaaf/core/impl/idp/module/test/TestRequestImpl.java @@ -24,13 +24,13 @@ import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; +import org.apache.commons.lang3.StringUtils; + import at.gv.egiz.eaaf.core.api.IRequest; import at.gv.egiz.eaaf.core.api.idp.ISpConfiguration; import at.gv.egiz.eaaf.core.exceptions.EaafStorageException; import at.gv.egiz.eaaf.core.impl.idp.auth.data.AuthProcessDataWrapper; -import org.apache.commons.lang3.StringUtils; - /** * Test pending-request for jUnit tests. * @@ -49,8 +49,9 @@ public class TestRequestImpl implements IRequest { private boolean authenticated; private boolean needAuthentication = false; private boolean stoppedByUser; + private boolean currentlyInIframe = false; private String piiTransactionId; - + /* * (non-Javadoc) * @@ -388,4 +389,15 @@ public class TestRequestImpl implements IRequest { this.needAuthentication = needAuthentication; } + @Override + public boolean isProcessInIframe() { + return this.currentlyInIframe; + } + + @Override + public void setProcessInFrame(boolean flag) { + this.currentlyInIframe = flag; + + } + } -- cgit v1.2.3