aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-frontend-resources/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/moa-id-frontend-resources/src/main')
-rw-r--r--id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/MOAIDGuiBilderConfigurationFactory.java33
-rw-r--r--id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/AbstractGUIFormBuilderConfiguration.java110
-rw-r--r--id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/AbstractServiceProviderSpecificGUIFormBuilderConfiguration.java15
-rw-r--r--id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/DefaultGUIFormBuilderConfiguration.java26
-rw-r--r--id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/GUIFormBuilderImpl.java167
-rw-r--r--id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/IGUIBuilderConfiguration.java74
-rw-r--r--id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/IGUIFormBuilder.java68
-rw-r--r--id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/SPSpecificGUIBuilderConfigurationWithDBLoad.java9
-rw-r--r--id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/SPSpecificGUIBuilderConfigurationWithFileSystemLoad.java8
-rw-r--r--id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/exception/GUIBuildException.java46
-rw-r--r--id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/utils/FormBuildUtils.java2
-rw-r--r--id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/velocity/VelocityLogAdapter.java99
-rw-r--r--id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/velocity/VelocityProvider.java121
13 files changed, 72 insertions, 706 deletions
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
new file mode 100644
index 000000000..f32b90eb0
--- /dev/null
+++ b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/MOAIDGuiBilderConfigurationFactory.java
@@ -0,0 +1,33 @@
+package at.gv.egovernment.moa.id.auth.frontend;
+
+import java.net.MalformedURLException;
+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.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,
+ DefaultGUIFormBuilderConfiguration.VIEW_ERRORMESSAGE, null);
+
+ }
+
+ @Override
+ public IGUIBuilderConfiguration getSPSpecificSAML2PostConfiguration(IRequest pendingReq, String viewName, URI configRootDir)
+ throws MalformedURLException {
+ return new SPSpecificGUIBuilderConfigurationWithFileSystemLoad(
+ pendingReq,
+ viewName,
+ MOAIDConfigurationConstants.SERVICE_AUTH_TEMPLATES_SAML2POSTBINDING_URL,
+ null,
+ configRootDir.toURL().toString());
+
+ }
+}
diff --git a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/AbstractGUIFormBuilderConfiguration.java b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/AbstractGUIFormBuilderConfiguration.java
deleted file mode 100644
index d57834192..000000000
--- a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/AbstractGUIFormBuilderConfiguration.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright 2014 Federal Chancellery Austria
- * MOA-ID has been developed in a cooperation between BRZ, the Federal
- * Chancellery Austria - ICT staff unit, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- */
-package at.gv.egovernment.moa.id.auth.frontend.builder;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import at.gv.egovernment.moa.util.MiscUtil;
-
-/**
- * @author tlenz
- *
- */
-public abstract class AbstractGUIFormBuilderConfiguration implements IGUIBuilderConfiguration {
-
- public static final String PARAM_AUTHCONTEXT = "contextPath";
- public static final String PARAM_FORMSUBMITENDPOINT = "submitEndpoint";
-
- public static final String PARAM_PENDINGREQUESTID = "pendingReqID";
-
- private String authURL = null;
- private String viewName = null;
- private String formSubmitEndpoint = null;
-
- /**
- * @param authURL IDP PublicURL-Prefix which should be used, but never null
- * @param viewName Name of the template (with suffix) but never null
- * @param formSubmitEndpoint EndPoint on which the form should be submitted,
- * or null if the form must not submitted
- *
- */
- public AbstractGUIFormBuilderConfiguration(String authURL, String viewName, String formSubmitEndpoint) {
- if (viewName.startsWith("/"))
- this.viewName = viewName.substring(1);
- else
- this.viewName = viewName;
-
- if (authURL.endsWith("/"))
- this.authURL = authURL.substring(0, authURL.length() - 1);
- else
- this.authURL = authURL;
-
- if (MiscUtil.isNotEmpty(formSubmitEndpoint)) {
- if (formSubmitEndpoint.startsWith("/"))
- this.formSubmitEndpoint = formSubmitEndpoint;
- else
- this.formSubmitEndpoint = "/" + formSubmitEndpoint;
- }
- }
-
-
- /**
- * Define the parameters, which should be evaluated in the template <br>
- * <b>IMPORTANT:</b> external HTML escapetion is required, because it is NOT done internally during the building process
- *
- * @return Map of parameters, which should be added to template
- */
- abstract protected Map<String, Object> getSpecificViewParameters();
-
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.auth.frontend.builder.IGUIBuilderConfiguration#getViewName()
- */
- @Override
- public final String getViewName() {
- return this.viewName;
-
- }
-
-
- /* (non-Javadoc)
- * @see at.gv.egovernment.moa.id.auth.frontend.builder.IGUIBuilderConfiguration#getViewParameters()
- */
- @Override
- public final Map<String, Object> getViewParameters() {
- //get parameters from detail implementation
- Map<String, Object> specParams = getSpecificViewParameters();
- if (specParams == null)
- specParams = new HashMap<String, Object>();
-
- //add generic parameters
- specParams.put(PARAM_AUTHCONTEXT, this.authURL);
- if (this.formSubmitEndpoint != null)
- specParams.put(PARAM_FORMSUBMITENDPOINT, this.formSubmitEndpoint);
-
- return specParams;
-
- }
-
-}
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 ad068ac49..2fcec92c5 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
@@ -29,10 +29,11 @@ import java.util.Map;
import org.apache.commons.lang.StringEscapeUtils;
+import at.gv.egiz.eaaf.core.api.IRequest;
+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;
import at.gv.egovernment.moa.id.commons.api.IOAAuthParameters;
-import at.gv.egovernment.moa.id.commons.api.IRequest;
import at.gv.egovernment.moa.id.commons.api.data.CPEPS;
import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.MiscUtil;
@@ -121,10 +122,10 @@ public abstract class AbstractServiceProviderSpecificGUIFormBuilderConfiguration
params.put(PARAM_BKU_LOCAL, IOAAuthParameters.LOCALBKU);
if (pendingReq != null) {
- params.put(PARAM_PENDINGREQUESTID, StringEscapeUtils.escapeHtml(pendingReq.getRequestID()));
+ params.put(PARAM_PENDINGREQUESTID, StringEscapeUtils.escapeHtml(pendingReq.getPendingRequestId()));
//add service-provider specific GUI parameters
- IOAAuthParameters oaParam = pendingReq.getOnlineApplicationConfiguration();
+ IOAAuthParameters oaParam = pendingReq.getServiceProviderConfiguration(IOAAuthParameters.class);
if (oaParam != null) {
params.put(PARAM_OANAME, StringEscapeUtils.escapeHtml(oaParam.getFriendlyName()));
@@ -170,7 +171,7 @@ public abstract class AbstractServiceProviderSpecificGUIFormBuilderConfiguration
*/
private void addCountrySelection(Map<String, Object> params, IOAAuthParameters oaParam) {
String pepslist = "";
- try {
+ try {
for (CPEPS current : oaParam.getPepsList()) {
String countryName = null;
if (MiscUtil.isNotEmpty(MOAIDAuthConstants.COUNTRYCODE_XX_TO_NAME.get(current.getFullCountryCode().toUpperCase())))
@@ -205,14 +206,14 @@ public abstract class AbstractServiceProviderSpecificGUIFormBuilderConfiguration
*/
@Override
public InputStream getTemplate(String viewName) {
- if (pendingReq != null && pendingReq.getOnlineApplicationConfiguration() != null) {
+ if (pendingReq != null && pendingReq.getServiceProviderConfiguration(IOAAuthParameters.class) != null) {
byte[] oatemplate = null;
if (VIEW_BKUSELECTION.equals(viewName))
- oatemplate = pendingReq.getOnlineApplicationConfiguration().getBKUSelectionTemplate();
+ oatemplate = pendingReq.getServiceProviderConfiguration(IOAAuthParameters.class).getBKUSelectionTemplate();
else if (VIEW_SENDASSERTION.equals(viewName))
- oatemplate = pendingReq.getOnlineApplicationConfiguration().getSendAssertionTemplate();
+ oatemplate = pendingReq.getServiceProviderConfiguration(IOAAuthParameters.class).getSendAssertionTemplate();
// OA specific template requires a size of 8 bits minimum
if (oatemplate != null && oatemplate.length > 7)
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 8cc7040dc..e59c19219 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
@@ -28,7 +28,9 @@ import java.util.Map;
import org.apache.commons.lang.StringEscapeUtils;
-import at.gv.egovernment.moa.id.commons.api.IRequest;
+import at.gv.egiz.eaaf.core.api.IRequest;
+import at.gv.egiz.eaaf.core.api.gui.ModifyableGuiBuilderConfiguration;
+import at.gv.egiz.eaaf.core.impl.gui.AbstractGUIFormBuilderConfiguration;
/**
* This class builds MOA-ID GUI forms from default resource paths
@@ -36,7 +38,7 @@ import at.gv.egovernment.moa.id.commons.api.IRequest;
* @author tlenz
*
*/
-public class DefaultGUIFormBuilderConfiguration extends AbstractGUIFormBuilderConfiguration {
+public class DefaultGUIFormBuilderConfiguration extends AbstractGUIFormBuilderConfiguration implements ModifyableGuiBuilderConfiguration {
public static final String VIEW_REDIRECT = "redirectForm.html";
public static final String VIEW_ERRORMESSAGE = "error_message.html";
@@ -70,13 +72,10 @@ public class DefaultGUIFormBuilderConfiguration extends AbstractGUIFormBuilderCo
}
- /**
- * Add a key/value pair into Velocity context.<br>
- * <b>IMPORTANT:</b> external HTML escapetion is required, because it is NOT done internally
- *
- * @param key velocity context key
- * @param value of this key
+ /* (non-Javadoc)
+ * @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) {
if (customParameters == null)
customParameters = new HashMap<String, Object>();
@@ -84,13 +83,10 @@ public class DefaultGUIFormBuilderConfiguration extends AbstractGUIFormBuilderCo
customParameters.put(key, value);
}
- /**
- * Add a key/value pair into Velocity context.<br>
- * All parameters get escaped internally
- *
- * @param key velocity context key
- * @param value of this key
+ /* (non-Javadoc)
+ * @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) {
if (customParameters == null)
customParameters = new HashMap<String, Object>();
@@ -106,7 +102,7 @@ public class DefaultGUIFormBuilderConfiguration extends AbstractGUIFormBuilderCo
public Map<String, Object> getSpecificViewParameters() {
Map<String, Object> params = new HashMap<String, Object>();
if (pendingReq != null) {
- params.put(PARAM_PENDINGREQUESTID, StringEscapeUtils.escapeHtml(pendingReq.getRequestID()));
+ params.put(PARAM_PENDINGREQUESTID, StringEscapeUtils.escapeHtml(pendingReq.getPendingRequestId()));
}
if (customParameters != 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 285c90163..43d499589 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
@@ -22,152 +22,40 @@
*/
package at.gv.egovernment.moa.id.auth.frontend.builder;
-import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
-import java.io.IOException;
import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.StringWriter;
import java.net.URI;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.app.VelocityEngine;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import at.gv.egovernment.moa.id.auth.frontend.exception.GUIBuildException;
-import at.gv.egovernment.moa.id.auth.frontend.velocity.VelocityProvider;
-import at.gv.egovernment.moa.id.commons.MOAIDConstants;
+import at.gv.egiz.eaaf.core.api.gui.IGUIBuilderConfiguration;
+import at.gv.egiz.eaaf.core.exceptions.GUIBuildException;
+import at.gv.egiz.eaaf.core.impl.gui.AbstractGUIFormBuilderImpl;
import at.gv.egovernment.moa.id.commons.api.AuthConfiguration;
import at.gv.egovernment.moa.logging.Logger;
-import at.gv.egovernment.moa.util.MiscUtil;
/**
* @author tlenz
*
*/
@Service("guiFormBuilder")
-public class GUIFormBuilderImpl implements IGUIFormBuilder {
+public class GUIFormBuilderImpl extends AbstractGUIFormBuilderImpl {
- private static final String DEFAULT_CONTENT_TYPE = MOAIDConstants.DEFAULT_CONTENT_TYPE_HTML_UTF8;
+
private static final String CONFIG_HTMLTEMPLATES_DIR = "htmlTemplates/";
private static final String CLASSPATH_HTMLTEMPLATES_DIR = "templates/";
@Autowired private AuthConfiguration authConfig;
- private VelocityEngine engine;
-
+
public GUIFormBuilderImpl() throws GUIBuildException {
- try {
- engine = VelocityProvider.getClassPathVelocityEngine();
-
- } catch (Exception e) {
- Logger.fatal("Initialization of Velocity-Engine to render GUI components FAILED.", e);
- throw new GUIBuildException("Initialization of Velocity-Engine to render GUI components FAILED.", e);
-
- }
+ super();
}
-
- public void build(HttpServletResponse httpResp, IGUIBuilderConfiguration config, String loggerName) throws GUIBuildException {
- build(httpResp, config, getInternalContentType(config), loggerName);
-
- }
-
- @Override
- public void build(HttpServletResponse httpResp, IGUIBuilderConfiguration config,
- String contentType, String loggerName) throws GUIBuildException {
-
- InputStream is = null;
- try {
- String viewName = config.getViewName();
- is = getTemplateInputStream(config);
-
- //build Velocity Context from input paramters
- VelocityContext context = buildContextFromViewParams(config.getViewParameters());
-
- //evaluate template
- StringWriter writer = new StringWriter();
- engine.evaluate(context, writer, loggerName, new BufferedReader(new InputStreamReader(is)));
-
- //write template to response
- final byte[] content = writer.toString().getBytes("UTF-8");
- httpResp.setStatus(HttpServletResponse.SC_OK);
- httpResp.setContentLength(content.length);
- httpResp.setContentType(contentType);
- httpResp.getOutputStream().write(content);
-
- if (Logger.isTraceEnabled()) {
- Logger.trace("Write Content for viewName:" + viewName
- + ". Contentsize:" + String.valueOf(content.length)
- + " BufferSize:" + httpResp.getBufferSize()
- + " ContentType:" + contentType);
- for (String el : httpResp.getHeaderNames())
- Logger.trace(" * Headername:" + el + " Value:" + httpResp.getHeader(el));
- }
-
- } catch (IOException e) {
- Logger.error("GUI form-builder has an internal error.", e);
- throw new GUIBuildException("GUI form-builder has an internal error.", e);
-
- } finally {
- if (is != null)
- try {
- is.close();
-
- } catch (IOException e) {
- Logger.error("Can NOT close GUI-Template InputStream.", e);
-
- }
- }
-
- }
-
- /**
- * Generate a new {@link VelocityContext} and populate it with MOA-ID GUI parameters
- *
- * @param config
- * @return
- */
- public VelocityContext generateVelocityContextFromConfiguration(IGUIBuilderConfiguration config) {
- return buildContextFromViewParams(config.getViewParameters());
-
- }
-
- /**
- * Load the template from different resources
- *
- * @param config
- * @return An {@link InputStream} but never null. The {@link InputStream} had to be closed be the invoking method
- * @throws GUIBuildException
- */
- public InputStream getTemplateInputStream(IGUIBuilderConfiguration config) throws GUIBuildException {
- InputStream is = getInternalTemplate(config);
- if (is == null) {
- Logger.warn("No GUI with viewName:" + config.getViewName() + " FOUND.");
- throw new GUIBuildException("No GUI with viewName:" + config.getViewName() + " FOUND.");
-
- }
- return is;
-
- }
-
- private String getInternalContentType(IGUIBuilderConfiguration config) {
- if (MiscUtil.isEmpty(config.getDefaultContentType()))
- return DEFAULT_CONTENT_TYPE;
-
- else
- return config.getDefaultContentType();
-
- }
-
- private InputStream getInternalTemplate(IGUIBuilderConfiguration config) throws GUIBuildException {
+ @Override
+ protected InputStream getInternalTemplate(IGUIBuilderConfiguration config) throws GUIBuildException {
String viewName = config.getViewName();
//load specific template
@@ -191,7 +79,7 @@ public class GUIFormBuilderImpl implements IGUIFormBuilder {
Logger.debug("GUI template:" + viewName + " is not found in configuration directory. "
+ " Load template from project library ... ");
try {
- pathLocation = getInternalClasspathTemplateDir(config) + viewName;
+ pathLocation = super.getInternalClasspathTemplateDir(config, CLASSPATH_HTMLTEMPLATES_DIR) + viewName;
is = Thread.currentThread()
.getContextClassLoader()
.getResourceAsStream(pathLocation);
@@ -217,39 +105,4 @@ public class GUIFormBuilderImpl implements IGUIFormBuilder {
}
-
- /**
- * @return
- */
- private String getInternalClasspathTemplateDir(IGUIBuilderConfiguration config) {
- String dir = config.getClasspathTemplateDir();
- if (dir != null) {
- if (!dir.endsWith("/"))
- dir += "/";
-
- return dir;
-
- } else
- return CLASSPATH_HTMLTEMPLATES_DIR;
- }
-
- /**
- * @param viewParams
- * @return
- */
- private VelocityContext buildContextFromViewParams(Map<String, Object> viewParams) {
- VelocityContext context = new VelocityContext();
-
- if (viewParams != null) {
- Iterator<Entry<String, Object>> interator = viewParams.entrySet().iterator();
- while (interator.hasNext()) {
- Entry<String, Object> el = interator.next();
- context.put(el.getKey(), el.getValue());
- }
-
- }
-
- return context;
- }
-
}
diff --git a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/IGUIBuilderConfiguration.java b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/IGUIBuilderConfiguration.java
deleted file mode 100644
index 51f6295c7..000000000
--- a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/IGUIBuilderConfiguration.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2014 Federal Chancellery Austria
- * MOA-ID has been developed in a cooperation between BRZ, the Federal
- * Chancellery Austria - ICT staff unit, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- */
-package at.gv.egovernment.moa.id.auth.frontend.builder;
-
-import java.io.InputStream;
-import java.util.Map;
-
-/**
- * @author tlenz
- *
- */
-public interface IGUIBuilderConfiguration {
-
-
- /**
- * Define the name of the template (with suffix) which should be used
- *
- * @return templatename, but never null
- */
- public String getViewName();
-
- /**
- * Define the parameters, which should be evaluated in the template
- *
- * @return Map of parameters, which should be added to template
- */
- public Map<String, Object> getViewParameters();
-
-
- /**
- * Get a specific classpath template-directory prefix, which is used
- * to load a template from classpath by using <code>ClassLoader.getResourceAsStream(...)</code>
- *
- * @return Classpath directory, or null if the default directory should be used
- */
- public String getClasspathTemplateDir();
-
- /**
- * Get the GUI template with a specific name
- *
- * @param viewName Name of the template
- * @return Tempate as <code>InputStream</code>, or null if default getTemplate method should be used
- */
- public InputStream getTemplate(String viewName);
-
- /**
- * Get the contentType, which should be set in HTTP response
- * <br><br>
- * <b>DefaultValue:</b> text/html;charset=UTF-8
- *
- * @return ContentType, or null if default ContentType should be used.
- */
- public String getDefaultContentType();
-}
diff --git a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/IGUIFormBuilder.java b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/IGUIFormBuilder.java
deleted file mode 100644
index 8e8a63094..000000000
--- a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/IGUIFormBuilder.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2014 Federal Chancellery Austria
- * MOA-ID has been developed in a cooperation between BRZ, the Federal
- * Chancellery Austria - ICT staff unit, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- */
-package at.gv.egovernment.moa.id.auth.frontend.builder;
-
-import javax.servlet.http.HttpServletResponse;
-
-import at.gv.egovernment.moa.id.auth.frontend.exception.GUIBuildException;
-
-/**
- * @author tlenz
- *
- */
-public interface IGUIFormBuilder {
-
- /**
- * Parse a GUI template, with parameters into a http servlet-response
- * and use the default http-response content-type.
- * <br><br>
- * The parser use the <code>VelocityEngine</code> as internal template evaluator.
- *
- * @param httpResp http-response object
- * @param viewName Name of the template (with suffix), which should be used.
- * The template is selected by using the <code>getTemplate(String viewName)</code> method
- * @param viewParams Map of parameters, which should be added to template
- * @param loggerName String, which should be used from logger
- *
- * @throws GUIBuildException
- */
- public void build(HttpServletResponse httpResp, IGUIBuilderConfiguration config, String loggerName) throws GUIBuildException;
-
- /**
- * Parse a GUI template, with parameters into a http servlet-response.
- * <br><br>
- * The parser use the <code>VelocityEngine</code> as internal template evaluator.
- *
- * @param httpResp http-response object
- * @param viewName Name of the template (with suffix), which should be used.
- * The template is selected by using the <code>getTemplate(String viewName)</code> method
- * @param viewParams Map of parameters, which should be added to template
- * @param contentType http-response content-type, which should be set
- * @param loggerName String, which should be used from logger
- *
- * @throws GUIBuildException
- */
- void build(HttpServletResponse httpResp, IGUIBuilderConfiguration config, String contentType,
- String loggerName) throws GUIBuildException;
-
-}
diff --git a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/SPSpecificGUIBuilderConfigurationWithDBLoad.java b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/SPSpecificGUIBuilderConfigurationWithDBLoad.java
index 0215afc41..8afda3c71 100644
--- a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/SPSpecificGUIBuilderConfigurationWithDBLoad.java
+++ b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/SPSpecificGUIBuilderConfigurationWithDBLoad.java
@@ -25,7 +25,8 @@ package at.gv.egovernment.moa.id.auth.frontend.builder;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
-import at.gv.egovernment.moa.id.commons.api.IRequest;
+import at.gv.egiz.eaaf.core.api.IRequest;
+import at.gv.egovernment.moa.id.commons.api.IOAAuthParameters;
/**
* @author tlenz
@@ -62,14 +63,14 @@ public class SPSpecificGUIBuilderConfigurationWithDBLoad extends AbstractService
*/
@Override
public InputStream getTemplate(String viewName) {
- if (pendingReq != null && pendingReq.getOnlineApplicationConfiguration() != null) {
+ if (pendingReq != null && pendingReq.getServiceProviderConfiguration() != null) {
byte[] oatemplate = null;
if (VIEW_BKUSELECTION.equals(viewName))
- oatemplate = pendingReq.getOnlineApplicationConfiguration().getBKUSelectionTemplate();
+ oatemplate = pendingReq.getServiceProviderConfiguration(IOAAuthParameters.class).getBKUSelectionTemplate();
else if (VIEW_SENDASSERTION.equals(viewName))
- oatemplate = pendingReq.getOnlineApplicationConfiguration().getSendAssertionTemplate();
+ oatemplate = pendingReq.getServiceProviderConfiguration(IOAAuthParameters.class).getSendAssertionTemplate();
// OA specific template requires a size of 8 bits minimum
if (oatemplate != null && oatemplate.length > 7)
diff --git a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/SPSpecificGUIBuilderConfigurationWithFileSystemLoad.java b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/SPSpecificGUIBuilderConfigurationWithFileSystemLoad.java
index b5c50004b..3e2bdda10 100644
--- a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/SPSpecificGUIBuilderConfigurationWithFileSystemLoad.java
+++ b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/builder/SPSpecificGUIBuilderConfigurationWithFileSystemLoad.java
@@ -31,9 +31,9 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
-import at.gv.egovernment.moa.id.commons.api.IRequest;
+import at.gv.egiz.eaaf.core.api.IRequest;
+import at.gv.egiz.eaaf.core.impl.utils.FileUtils;
import at.gv.egovernment.moa.logging.Logger;
-import at.gv.egovernment.moa.util.FileUtils;
import at.gv.egovernment.moa.util.MiscUtil;
/**
@@ -81,10 +81,10 @@ public class SPSpecificGUIBuilderConfigurationWithFileSystemLoad extends Abstrac
*/
@Override
public InputStream getTemplate(String viewName) {
- if (pendingReq != null && pendingReq.getOnlineApplicationConfiguration() != null &&
+ if (pendingReq != null && pendingReq.getServiceProviderConfiguration() != null &&
configKeyIdentifier != null) {
try {
- String templateURL = pendingReq.getOnlineApplicationConfiguration().getConfigurationValue(configKeyIdentifier);
+ String templateURL = pendingReq.getServiceProviderConfiguration().getConfigurationValue(configKeyIdentifier);
if (MiscUtil.isNotEmpty(templateURL)) {
String absURL = FileUtils.makeAbsoluteURL(templateURL, configRootContextDir);
if (!absURL.startsWith("file:")) {
diff --git a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/exception/GUIBuildException.java b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/exception/GUIBuildException.java
deleted file mode 100644
index fff458546..000000000
--- a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/exception/GUIBuildException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2014 Federal Chancellery Austria
- * MOA-ID has been developed in a cooperation between BRZ, the Federal
- * Chancellery Austria - ICT staff unit, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- */
-package at.gv.egovernment.moa.id.auth.frontend.exception;
-
-/**
- * @author tlenz
- *
- */
-public class GUIBuildException extends Exception {
-
- private static final long serialVersionUID = -278663750102498205L;
-
- /**
- * @param string
- */
- public GUIBuildException(String msg) {
- super(msg);
-
- }
-
- public GUIBuildException(String msg, Throwable e) {
- super(msg, e);
-
- }
-
-}
diff --git a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/utils/FormBuildUtils.java b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/utils/FormBuildUtils.java
index 66bfd9c3e..53ec222dc 100644
--- a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/utils/FormBuildUtils.java
+++ b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/utils/FormBuildUtils.java
@@ -76,7 +76,7 @@ public class FormBuildUtils {
defaultmap.put(PARAM_REDIRECTTARGET, "_top");
}
- }
+ }
public static void customiceLayoutBKUSelection(Map<String, Object> params, IOAAuthParameters oaParam) {
diff --git a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/velocity/VelocityLogAdapter.java b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/velocity/VelocityLogAdapter.java
deleted file mode 100644
index 3d5c5ed2f..000000000
--- a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/velocity/VelocityLogAdapter.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright 2014 Federal Chancellery Austria
- * MOA-ID has been developed in a cooperation between BRZ, the Federal
- * Chancellery Austria - ICT staff unit, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-package at.gv.egovernment.moa.id.auth.frontend.velocity;
-
-import org.apache.velocity.app.Velocity;
-import org.apache.velocity.runtime.RuntimeServices;
-import org.apache.velocity.runtime.log.LogChute;
-
-import at.gv.egovernment.moa.logging.Logger;
-
-public class VelocityLogAdapter implements LogChute {
-
- public VelocityLogAdapter() {
- try
- {
- /*
- * register this class as a logger with the Velocity singleton
- * (NOTE: this would not work for the non-singleton method.)
- */
- Velocity.setProperty(Velocity.RUNTIME_LOG_LOGSYSTEM, this );
- Velocity.init();
- }
- catch (Exception e)
- {
- Logger.error("Failed to register Velocity logger");
- }
- }
-
- public void init(RuntimeServices arg0) throws Exception {
- }
-
- public boolean isLevelEnabled(int arg0) {
- switch(arg0) {
- case LogChute.DEBUG_ID:
- return Logger.isDebugEnabled();
- case LogChute.TRACE_ID:
- return Logger.isTraceEnabled();
- default:
- return true;
- }
- }
-
- public void log(int arg0, String arg1) {
- switch(arg0) {
- case LogChute.DEBUG_ID:
- Logger.debug(arg1);
- break;
- case LogChute.TRACE_ID:
- Logger.trace(arg1);
- break;
- case LogChute.INFO_ID:
- Logger.info(arg1);
- break;
- case LogChute.WARN_ID:
- Logger.warn(arg1);
- break;
- case LogChute.ERROR_ID:
- default:
- Logger.error(arg1);
- break;
- }
- }
-
- public void log(int arg0, String arg1, Throwable arg2) {
- switch(arg0) {
- case LogChute.DEBUG_ID:
- case LogChute.TRACE_ID:
- case LogChute.INFO_ID:
- case LogChute.WARN_ID:
- Logger.warn(arg1, arg2);
- break;
- case LogChute.ERROR_ID:
- default:
- Logger.error(arg1, arg2);
- break;
- }
- }
-
-}
diff --git a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/velocity/VelocityProvider.java b/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/velocity/VelocityProvider.java
deleted file mode 100644
index 015d8e321..000000000
--- a/id/server/moa-id-frontend-resources/src/main/java/at/gv/egovernment/moa/id/auth/frontend/velocity/VelocityProvider.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright 2014 Federal Chancellery Austria
- * MOA-ID has been developed in a cooperation between BRZ, the Federal
- * Chancellery Austria - ICT staff unit, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- ******************************************************************************/
-/*
- * Copyright 2011 by Graz University of Technology, Austria
- * The Austrian STORK Modules have been developed by the E-Government
- * Innovation Center EGIZ, a joint initiative of the Federal Chancellery
- * Austria and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- */
-
-
-/**
- *
- */
-package at.gv.egovernment.moa.id.auth.frontend.velocity;
-
-import org.apache.velocity.app.Velocity;
-import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.runtime.RuntimeConstants;
-
-/**
- * Gets a Velocity Engine
- *
- * @author bzwattendorfer
- *
- */
-public class VelocityProvider {
-
- private static VelocityEngine velocityEngine = null;
-
- /**
- * Gets velocityEngine from Classpath
- * @return VelocityEngine
- * @throws Exception
- */
- public static VelocityEngine getClassPathVelocityEngine() throws Exception {
- if (velocityEngine == null) {
- velocityEngine = getBaseVelocityEngine();
- velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
- velocityEngine.setProperty("classpath.resource.loader.class",
- "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
- velocityEngine.init();
-
- }
-
- return velocityEngine;
- }
-
- /**
- * Gets VelocityEngine from File
- * @param rootPath File Path to template file
- * @return VelocityEngine
- * @throws Exception
- */
- public static VelocityEngine getFileVelocityEngine(String rootPath) throws Exception {
- if (velocityEngine == null) {
- velocityEngine = getBaseVelocityEngine();
- velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER, "file");
- velocityEngine.setProperty("file.resource.loader.class",
- "org.apache.velocity.runtime.resource.loader.FileResourceLoader");
- velocityEngine.setProperty("file.resource.loader.path", rootPath);
-
- velocityEngine.init();
-
- }
-
- return velocityEngine;
- }
-
- /**
- * Gets a basic VelocityEngine
- * @return VelocityEngine
- */
- private static VelocityEngine getBaseVelocityEngine() {
- VelocityEngine velocityEngine = new VelocityEngine();
- velocityEngine.setProperty(RuntimeConstants.INPUT_ENCODING, "UTF-8");
- velocityEngine.setProperty(RuntimeConstants.OUTPUT_ENCODING, "UTF-8");
-// velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
-// "org.apache.velocity.runtime.log.SimpleLog4JLogSystem");
- velocityEngine.setProperty(Velocity.RUNTIME_LOG_LOGSYSTEM, new VelocityLogAdapter() );
-
- return velocityEngine;
- }
-
-}