From fda1a8333b9bd11d0457125c3156a39f03d74bd6 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 2 Aug 2019 12:02:35 +0200 Subject: Refactoring to eIDASNode 2.2, eaaf-components 1.0.8 --- .../config/BasicConfigurationProvider.java | 4 +-- .../connector/gui/DefaultGUIBuilderImpl.java | 11 ++++---- .../gui/GUIBuilderConfigurationFactory.java | 3 +- .../gui/StaticGuiBuilderConfiguration.java | 32 ++++++++++++---------- 4 files changed, 27 insertions(+), 23 deletions(-) (limited to 'connector_lib/src/main') diff --git a/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/config/BasicConfigurationProvider.java b/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/config/BasicConfigurationProvider.java index 35b07299..4793e085 100644 --- a/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/config/BasicConfigurationProvider.java +++ b/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/config/BasicConfigurationProvider.java @@ -55,7 +55,7 @@ public class BasicConfigurationProvider extends AbstractConfigurationImpl{ public ISPConfiguration getServiceProviderConfiguration(String entityId) throws EAAFConfigurationException { if (!spConfigCache.containsKey(entityId)) { log.debug("SP: " + entityId + " is NOT cached. Starting load operation ... "); - Map allSPs = getBasicMOAIDConfigurationWithPrefix(MSeIDASNodeConstants.PROP_CONFIG_SP_LIST_PREFIX); + Map allSPs = getBasicConfigurationWithPrefix(MSeIDASNodeConstants.PROP_CONFIG_SP_LIST_PREFIX); for (String key : allSPs.keySet()) { if (key.endsWith(MSeIDASNodeConstants.PROP_CONFIG_SP_UNIQUEIDENTIFIER) && allSPs.get(key).equals(entityId)) { @@ -114,7 +114,7 @@ public class BasicConfigurationProvider extends AbstractConfigurationImpl{ if (urlPrefixFromConfig.endsWith("/")) urlPrefixFromConfig = urlPrefixFromConfig.substring(0, urlPrefixFromConfig.length()-1); - if (getBasicMOAIDConfigurationBoolean( + if (getBasicConfigurationBoolean( MSeIDASNodeConstants.PROP_CONFIG_APPLICATION_PUBLIC_URL_REQUEST_VALIDATION, false)) { if (url != null && url.toExternalForm().startsWith(urlPrefixFromConfig)) return urlPrefixFromConfig; diff --git a/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/DefaultGUIBuilderImpl.java b/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/DefaultGUIBuilderImpl.java index 082d6993..f4049267 100644 --- a/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/DefaultGUIBuilderImpl.java +++ b/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/DefaultGUIBuilderImpl.java @@ -28,13 +28,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; -import at.gv.egiz.eaaf.core.api.gui.IGUIBuilderConfiguration; import at.gv.egiz.eaaf.core.api.gui.IGUIFormBuilder; +import at.gv.egiz.eaaf.core.api.gui.IVelocityGUIBuilderConfiguration; import at.gv.egiz.eaaf.core.exceptions.GUIBuildException; -import at.gv.egiz.eaaf.core.impl.gui.AbstractGUIFormBuilderImpl; +import at.gv.egiz.eaaf.core.impl.gui.AbstractVelocityGUIFormBuilderImpl; @Service("DefaultGUIBuilderImpl") -public class DefaultGUIBuilderImpl extends AbstractGUIFormBuilderImpl implements IGUIFormBuilder { +public class DefaultGUIBuilderImpl extends AbstractVelocityGUIFormBuilderImpl implements IGUIFormBuilder { private static final Logger log = LoggerFactory.getLogger(DefaultGUIBuilderImpl.class); private static final String CLASSPATH_HTMLTEMPLATES_DIR = "templates/"; @@ -45,7 +45,7 @@ public class DefaultGUIBuilderImpl extends AbstractGUIFormBuilderImpl implements } @Override - protected InputStream getInternalTemplate(IGUIBuilderConfiguration config) throws GUIBuildException { + protected InputStream getInternalTemplate(IVelocityGUIBuilderConfiguration config) throws GUIBuildException { String viewName = config.getViewName(); log.debug("GUI template:" + viewName + " is not found in configuration directory. " + " Load template from project library ... "); @@ -58,8 +58,7 @@ public class DefaultGUIBuilderImpl extends AbstractGUIFormBuilderImpl implements log.error("GUI template:" + pathLocation + " is NOT loadable from classpath!", e1); throw new GUIBuildException("GUI template:" + pathLocation + " is NOT loadable from classpath!", e1); - } - + } } } diff --git a/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/GUIBuilderConfigurationFactory.java b/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/GUIBuilderConfigurationFactory.java index 025c6a24..e0ce6b3e 100644 --- a/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/GUIBuilderConfigurationFactory.java +++ b/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/GUIBuilderConfigurationFactory.java @@ -34,6 +34,7 @@ import at.asitplus.eidas.specific.connector.MSeIDASNodeConstants; import at.gv.egiz.eaaf.core.api.IRequest; import at.gv.egiz.eaaf.core.api.gui.IGUIBuilderConfiguration; import at.gv.egiz.eaaf.core.api.gui.IGUIBuilderConfigurationFactory; +import at.gv.egiz.eaaf.core.api.gui.IVelocityGUIBuilderConfiguration; import at.gv.egiz.eaaf.core.api.idp.IConfiguration; @Service("GUIBuilderConfigurationFactory") @@ -46,7 +47,7 @@ public class GUIBuilderConfigurationFactory implements IGUIBuilderConfigurationF } @Override - public IGUIBuilderConfiguration getSPSpecificSAML2PostConfiguration(IRequest pendingReq, String viewName, URI configRootContextDir) + public IVelocityGUIBuilderConfiguration getSPSpecificSAML2PostConfiguration(IRequest pendingReq, String viewName, URI configRootContextDir) throws MalformedURLException { return new StaticGuiBuilderConfiguration(basicConfig, pendingReq,MSeIDASNodeConstants.TEMPLATE_HTML_PVP_POSTBINDING , null); } diff --git a/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/StaticGuiBuilderConfiguration.java b/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/StaticGuiBuilderConfiguration.java index aa5e1238..088c48a7 100644 --- a/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/StaticGuiBuilderConfiguration.java +++ b/connector_lib/src/main/java/at/asitplus/eidas/specific/connector/gui/StaticGuiBuilderConfiguration.java @@ -32,8 +32,6 @@ import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; -import java.util.HashMap; -import java.util.Map; import org.apache.commons.lang.StringEscapeUtils; import org.slf4j.Logger; @@ -41,17 +39,17 @@ import org.slf4j.LoggerFactory; import at.asitplus.eidas.specific.connector.MSeIDASNodeConstants; import at.gv.egiz.eaaf.core.api.IRequest; +import at.gv.egiz.eaaf.core.api.gui.IVelocityGUIBuilderConfiguration; import at.gv.egiz.eaaf.core.api.gui.ModifyableGuiBuilderConfiguration; import at.gv.egiz.eaaf.core.api.idp.IConfiguration; import at.gv.egiz.eaaf.core.impl.gui.AbstractGUIFormBuilderConfiguration; import at.gv.egiz.eaaf.core.impl.utils.FileUtils; -public class StaticGuiBuilderConfiguration extends AbstractGUIFormBuilderConfiguration implements ModifyableGuiBuilderConfiguration { +public class StaticGuiBuilderConfiguration extends AbstractGUIFormBuilderConfiguration implements IVelocityGUIBuilderConfiguration, ModifyableGuiBuilderConfiguration { private static final Logger log = LoggerFactory.getLogger(StaticGuiBuilderConfiguration.class); private IRequest pendingReq = null; private IConfiguration basicConfig = null; - Map params = new HashMap(); public StaticGuiBuilderConfiguration(IConfiguration basicConfig, String authURL, String viewName, String formSubmitEndpoint) { super(authURL, viewName, formSubmitEndpoint); @@ -103,24 +101,30 @@ public class StaticGuiBuilderConfiguration extends AbstractGUIFormBuilderConfigu } @Override - protected Map getSpecificViewParameters() { - if (pendingReq != null) { - params.put(PARAM_PENDINGREQUESTID, StringEscapeUtils.escapeHtml(pendingReq.getPendingRequestId())); - - } + public void putCustomParameterWithOutEscaption(String group, String key, Object value) { + log.info("Add GUI-Template parameters WITHOUT escaption ARE NOT supported!!!!!"); - return params; } @Override - public void putCustomParameter(String key, String value) { - params.put(key, StringEscapeUtils.escapeHtml(value)); + public void putCustomParameter(String group, String key, String value) { + setViewParameter(getFromGroup(), key, StringEscapeUtils.escapeHtml(value)); } @Override - public void putCustomParameterWithOutEscaption(String arg0, Object arg1) { - log.info("Add GUI-Template parameters WITHOUT escaption ARE NOT supported!!!!!"); + protected void putSpecificViewParameters() { + if (pendingReq != null) { + setViewParameter(getFromGroup(), PARAM_PENDINGREQUESTID, StringEscapeUtils.escapeHtml(pendingReq.getPendingRequestId())); + setViewParameter(getFromGroup(), PARAM_PENDINGREQUESTID_DEPRECATED, StringEscapeUtils.escapeHtml(pendingReq.getPendingRequestId())); + + } + + } + + @Override + protected String getFromGroup() { + return null; } -- cgit v1.2.3