From ac531e30d13d6714e2ac61f7329e6adc130aa288 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 24 May 2019 12:23:41 +0200 Subject: untested switch to EAAF-components 1.0.7 --- .../MOAIDGuiBilderConfigurationFactory.java | 5 +- ...roviderSpecificGUIFormBuilderConfiguration.java | 55 +++++++++++++--------- .../DefaultGUIFormBuilderConfiguration.java | 23 +++++---- .../auth/frontend/builder/GUIFormBuilderImpl.java | 8 ++-- 4 files changed, 54 insertions(+), 37 deletions(-) (limited to 'id/server/moa-id-frontend-resources') diff --git a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/MOAIDGuiBilderConfigurationFactory.java b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/MOAIDGuiBilderConfigurationFactory.java index f32b90eb0..2422fdfa8 100644 --- a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/MOAIDGuiBilderConfigurationFactory.java +++ b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/MOAIDGuiBilderConfigurationFactory.java @@ -6,12 +6,13 @@ import java.net.URI; 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.egovernment.moa.id.auth.frontend.builder.DefaultGUIFormBuilderConfiguration; import at.gv.egovernment.moa.id.auth.frontend.builder.SPSpecificGUIBuilderConfigurationWithFileSystemLoad; import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants; public class MOAIDGuiBilderConfigurationFactory implements IGUIBuilderConfigurationFactory { - + @Override public IGUIBuilderConfiguration getDefaultErrorGUI(String authURL) { return new DefaultGUIFormBuilderConfiguration(authURL, @@ -20,7 +21,7 @@ public class MOAIDGuiBilderConfigurationFactory implements IGUIBuilderConfigurat } @Override - public IGUIBuilderConfiguration getSPSpecificSAML2PostConfiguration(IRequest pendingReq, String viewName, URI configRootDir) + public IVelocityGUIBuilderConfiguration getSPSpecificSAML2PostConfiguration(IRequest pendingReq, String viewName, URI configRootDir) throws MalformedURLException { return new SPSpecificGUIBuilderConfigurationWithFileSystemLoad( pendingReq, diff --git a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/AbstractServiceProviderSpecificGUIFormBuilderConfiguration.java b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/AbstractServiceProviderSpecificGUIFormBuilderConfiguration.java index c9dcd291a..5ef48526e 100644 --- a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/AbstractServiceProviderSpecificGUIFormBuilderConfiguration.java +++ b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/AbstractServiceProviderSpecificGUIFormBuilderConfiguration.java @@ -26,10 +26,12 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.HashMap; import java.util.Map; +import java.util.Map.Entry; import org.apache.commons.lang.StringEscapeUtils; import at.gv.egiz.eaaf.core.api.IRequest; +import at.gv.egiz.eaaf.core.api.gui.IVelocityGUIBuilderConfiguration; import at.gv.egiz.eaaf.core.impl.gui.AbstractGUIFormBuilderConfiguration; import at.gv.egovernment.moa.id.auth.frontend.utils.FormBuildUtils; import at.gv.egovernment.moa.id.commons.MOAIDAuthConstants; @@ -42,7 +44,8 @@ import at.gv.egovernment.moa.util.MiscUtil; * @author tlenz * */ -public abstract class AbstractServiceProviderSpecificGUIFormBuilderConfiguration extends AbstractGUIFormBuilderConfiguration { +public abstract class AbstractServiceProviderSpecificGUIFormBuilderConfiguration extends AbstractGUIFormBuilderConfiguration + implements IVelocityGUIBuilderConfiguration { public static final String VIEW_TEMPLATE_MAINGUI_DIRECTORY = "mainGUI/"; @@ -116,59 +119,65 @@ public abstract class AbstractServiceProviderSpecificGUIFormBuilderConfiguration * @see at.gv.egovernment.moa.id.auth.frontend.builder.IGUIBuilderConfiguration#getViewParameters() */ @Override - public final Map getSpecificViewParameters() { - Map params = new HashMap(); - params.put(PARAM_BKU_ONLINE, IOAAuthParameters.THIRDBKU); - params.put(PARAM_BKU_HANDY, IOAAuthParameters.HANDYBKU); - params.put(PARAM_BKU_LOCAL, IOAAuthParameters.LOCALBKU); + public final void putSpecificViewParameters() { + + if (customParameters == null) + customParameters = new HashMap(); + + setViewParameter(null, PARAM_BKU_ONLINE, IOAAuthParameters.THIRDBKU); + setViewParameter(null, PARAM_BKU_HANDY, IOAAuthParameters.HANDYBKU); + setViewParameter(null, PARAM_BKU_LOCAL, IOAAuthParameters.LOCALBKU); if (pendingReq != null) { - params.put(PARAM_PENDINGREQUESTID, StringEscapeUtils.escapeHtml(pendingReq.getPendingRequestId())); + setViewParameter(null, PARAM_PENDINGREQUESTID, StringEscapeUtils.escapeHtml(pendingReq.getPendingRequestId())); //add service-provider specific GUI parameters IOAAuthParameters oaParam = pendingReq.getServiceProviderConfiguration(IOAAuthParameters.class); if (oaParam != null) { - params.put(PARAM_OANAME, StringEscapeUtils.escapeHtml(oaParam.getFriendlyName())); + setViewParameter(null, PARAM_OANAME, StringEscapeUtils.escapeHtml(oaParam.getFriendlyName())); //set BKU URLs if (MiscUtil.isNotEmpty(oaParam.getBKUURL(IOAAuthParameters.LOCALBKU))) - params.put(PARAM_BKU_URL_LOCAL, oaParam.getBKUURL(IOAAuthParameters.LOCALBKU)); + setViewParameter(null, PARAM_BKU_URL_LOCAL, oaParam.getBKUURL(IOAAuthParameters.LOCALBKU)); else - params.put(PARAM_BKU_URL_LOCAL, MOAIDAuthConstants.DEFAULT_BKU_HTTPS); + setViewParameter(null, PARAM_BKU_URL_LOCAL, MOAIDAuthConstants.DEFAULT_BKU_HTTPS); if (MiscUtil.isNotEmpty(oaParam.getBKUURL(IOAAuthParameters.HANDYBKU))) - params.put(PARAM_BKU_URL_HANDY, oaParam.getBKUURL(IOAAuthParameters.HANDYBKU)); + setViewParameter(null, PARAM_BKU_URL_HANDY, oaParam.getBKUURL(IOAAuthParameters.HANDYBKU)); if (MiscUtil.isNotEmpty(oaParam.getBKUURL(IOAAuthParameters.THIRDBKU))) - params.put(PARAM_BKU_URL_THIRD, oaParam.getBKUURL(IOAAuthParameters.THIRDBKU)); + setViewParameter(null, PARAM_BKU_URL_THIRD, oaParam.getBKUURL(IOAAuthParameters.THIRDBKU)); //set eIDAS login information if requird if (oaParam.isShowStorkLogin()) { - addCountrySelection(params, oaParam); - params.put(PARAM_EIDAS_VISIBLE, ""); + addCountrySelection(customParameters, oaParam); + setViewParameter(null, PARAM_EIDAS_VISIBLE, ""); } else { - params.put(PARAM_COUNTRYLIST, ""); - params.put(PARAM_EIDAS_VISIBLE, FormBuildUtils.TEMPLATEVISIBLE); + setViewParameter(null, PARAM_COUNTRYLIST, ""); + setViewParameter(null, PARAM_EIDAS_VISIBLE, FormBuildUtils.TEMPLATEVISIBLE); } - FormBuildUtils.customiceLayoutBKUSelection(params, oaParam); + FormBuildUtils.customiceLayoutBKUSelection(customParameters, oaParam); } else - FormBuildUtils.defaultLayoutBKUSelection(params); + FormBuildUtils.defaultLayoutBKUSelection(customParameters); } else { //add default GUI parameters - FormBuildUtils.defaultLayoutBKUSelection(params); + FormBuildUtils.defaultLayoutBKUSelection(customParameters); } //add additional custom parameters - if (customParameters != null) - params.putAll(customParameters); + if (customParameters != null) { + for (Entry el : customParameters.entrySet()) + setViewParameter(null, el.getKey(), el.getValue()); + } + - return params; + } /** @@ -246,6 +255,8 @@ public abstract class AbstractServiceProviderSpecificGUIFormBuilderConfiguration public void setTemplateClasspahtDir(String templateClasspahtDir) { this.templateClasspahtDir = templateClasspahtDir; } + + diff --git a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/DefaultGUIFormBuilderConfiguration.java b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/DefaultGUIFormBuilderConfiguration.java index e59c19219..85d8413ae 100644 --- a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/DefaultGUIFormBuilderConfiguration.java +++ b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/DefaultGUIFormBuilderConfiguration.java @@ -25,10 +25,12 @@ package at.gv.egovernment.moa.id.auth.frontend.builder; import java.io.InputStream; import java.util.HashMap; import java.util.Map; +import java.util.Map.Entry; import org.apache.commons.lang.StringEscapeUtils; 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.impl.gui.AbstractGUIFormBuilderConfiguration; @@ -38,7 +40,7 @@ import at.gv.egiz.eaaf.core.impl.gui.AbstractGUIFormBuilderConfiguration; * @author tlenz * */ -public class DefaultGUIFormBuilderConfiguration extends AbstractGUIFormBuilderConfiguration implements ModifyableGuiBuilderConfiguration { +public class DefaultGUIFormBuilderConfiguration extends AbstractGUIFormBuilderConfiguration implements ModifyableGuiBuilderConfiguration, IVelocityGUIBuilderConfiguration { public static final String VIEW_REDIRECT = "redirectForm.html"; public static final String VIEW_ERRORMESSAGE = "error_message.html"; @@ -76,7 +78,7 @@ public class DefaultGUIFormBuilderConfiguration extends AbstractGUIFormBuilderCo * @see at.gv.egovernment.moa.id.auth.frontend.builder.ModifyableGuiBuilderConfiguration#putCustomParameterWithOutEscaption(java.lang.String, java.lang.Object) */ @Override - public void putCustomParameterWithOutEscaption(String key, Object value) { + public void putCustomParameterWithOutEscaption(String group, String key, Object value) { if (customParameters == null) customParameters = new HashMap(); @@ -87,7 +89,7 @@ public class DefaultGUIFormBuilderConfiguration extends AbstractGUIFormBuilderCo * @see at.gv.egovernment.moa.id.auth.frontend.builder.ModifyableGuiBuilderConfiguration#putCustomParameter(java.lang.String, java.lang.String) */ @Override - public void putCustomParameter(String key, String value) { + public void putCustomParameter(String group, String key, String value) { if (customParameters == null) customParameters = new HashMap(); @@ -99,16 +101,17 @@ public class DefaultGUIFormBuilderConfiguration extends AbstractGUIFormBuilderCo * @see at.gv.egovernment.moa.id.auth.frontend.builder.IGUIBuilderConfiguration#getViewParameters() */ @Override - public Map getSpecificViewParameters() { - Map params = new HashMap(); + public void putSpecificViewParameters() { if (pendingReq != null) { - params.put(PARAM_PENDINGREQUESTID, StringEscapeUtils.escapeHtml(pendingReq.getPendingRequestId())); + setViewParameter(null, PARAM_PENDINGREQUESTID, StringEscapeUtils.escapeHtml(pendingReq.getPendingRequestId())); } - if (customParameters != null) - params.putAll(customParameters); + //add additional custom parameters + if (customParameters != null) { + for (Entry el : customParameters.entrySet()) + setViewParameter(null, el.getKey(), el.getValue()); + } - return params; } /* (non-Javadoc) @@ -137,4 +140,6 @@ public class DefaultGUIFormBuilderConfiguration extends AbstractGUIFormBuilderCo return null; } + + } diff --git a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/GUIFormBuilderImpl.java b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/GUIFormBuilderImpl.java index 43d499589..20f919d0c 100644 --- a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/GUIFormBuilderImpl.java +++ b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/GUIFormBuilderImpl.java @@ -30,9 +30,9 @@ import java.net.URI; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import at.gv.egiz.eaaf.core.api.gui.IGUIBuilderConfiguration; +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; import at.gv.egovernment.moa.id.commons.api.AuthConfiguration; import at.gv.egovernment.moa.logging.Logger; @@ -41,7 +41,7 @@ import at.gv.egovernment.moa.logging.Logger; * */ @Service("guiFormBuilder") -public class GUIFormBuilderImpl extends AbstractGUIFormBuilderImpl { +public class GUIFormBuilderImpl extends AbstractVelocityGUIFormBuilderImpl { private static final String CONFIG_HTMLTEMPLATES_DIR = "htmlTemplates/"; @@ -55,7 +55,7 @@ public class GUIFormBuilderImpl extends AbstractGUIFormBuilderImpl { } @Override - protected InputStream getInternalTemplate(IGUIBuilderConfiguration config) throws GUIBuildException { + protected InputStream getInternalTemplate(IVelocityGUIBuilderConfiguration config) throws GUIBuildException { String viewName = config.getViewName(); //load specific template -- cgit v1.2.3