aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2016-03-14 09:17:57 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2016-03-14 09:17:57 +0100
commitf67427831d1f8c49ce6c474691b880d90a42b584 (patch)
treeb585458d013dbcbae7374209a1e9239d59c34eaf /id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder
parent0fe2bed17c674587a60e63fac211a0354ab4ef03 (diff)
downloadmoa-id-spss-f67427831d1f8c49ce6c474691b880d90a42b584.tar.gz
moa-id-spss-f67427831d1f8c49ce6c474691b880d90a42b584.tar.bz2
moa-id-spss-f67427831d1f8c49ce6c474691b880d90a42b584.zip
refactor the GUI generation for user interaction
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationDataBuilder.java14
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/CreateXMLSignatureRequestBuilder.java6
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/DataURLBuilder.java2
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/DynamicOAAuthParameterBuilder.java6
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/GUILayoutBuilder.java157
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/LoginFormBuilder.java171
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/RedirectFormBuilder.java65
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/SendAssertionFormBuilder.java147
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/SignatureVerificationUtils.java2
9 files changed, 15 insertions, 555 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationDataBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationDataBuilder.java
index 32fabc3f4..4c83d0ea4 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationDataBuilder.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/AuthenticationDataBuilder.java
@@ -47,7 +47,6 @@ import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import at.gv.egovernment.moa.id.auth.MOAIDAuthConstants;
import at.gv.egovernment.moa.id.auth.data.AuthenticationSession;
import at.gv.egovernment.moa.id.auth.data.AuthenticationSessionStorageConstants;
import at.gv.egovernment.moa.id.auth.data.ExtendedSAMLAttribute;
@@ -55,21 +54,22 @@ import at.gv.egovernment.moa.id.auth.data.IdentityLink;
import at.gv.egovernment.moa.id.auth.data.VerifyXMLSignatureResponse;
import at.gv.egovernment.moa.id.auth.exception.BuildException;
import at.gv.egovernment.moa.id.auth.exception.DynamicOABuildException;
-import at.gv.egovernment.moa.id.auth.exception.MOAIDException;
import at.gv.egovernment.moa.id.auth.exception.ParseException;
-import at.gv.egovernment.moa.id.auth.exception.SessionDataStorageException;
import at.gv.egovernment.moa.id.auth.exception.WrongParametersException;
import at.gv.egovernment.moa.id.auth.parser.IdentityLinkAssertionParser;
+import at.gv.egovernment.moa.id.commons.MOAIDAuthConstants;
+import at.gv.egovernment.moa.id.commons.api.AuthConfiguration;
+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.exceptions.ConfigurationException;
+import at.gv.egovernment.moa.id.commons.api.exceptions.MOAIDException;
+import at.gv.egovernment.moa.id.commons.api.exceptions.SessionDataStorageException;
import at.gv.egovernment.moa.id.commons.db.dao.session.OASessionStore;
-import at.gv.egovernment.moa.id.config.ConfigurationException;
-import at.gv.egovernment.moa.id.config.auth.AuthConfiguration;
-import at.gv.egovernment.moa.id.config.auth.IOAAuthParameters;
import at.gv.egovernment.moa.id.data.AuthenticationData;
import at.gv.egovernment.moa.id.data.AuthenticationRoleFactory;
import at.gv.egovernment.moa.id.data.IAuthData;
import at.gv.egovernment.moa.id.data.MISMandate;
import at.gv.egovernment.moa.id.data.Pair;
-import at.gv.egovernment.moa.id.moduls.IRequest;
import at.gv.egovernment.moa.id.moduls.RequestImpl;
import at.gv.egovernment.moa.id.protocols.pvp2x.PVPConstants;
import at.gv.egovernment.moa.id.protocols.pvp2x.PVPTargetConfiguration;
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/CreateXMLSignatureRequestBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/CreateXMLSignatureRequestBuilder.java
index e763c5355..73fe961eb 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/CreateXMLSignatureRequestBuilder.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/CreateXMLSignatureRequestBuilder.java
@@ -50,10 +50,10 @@ import java.text.MessageFormat;
import java.util.Calendar;
import java.util.List;
-import at.gv.egovernment.moa.id.auth.MOAIDAuthConstants;
+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.config.TargetToSectorNameMapper;
-import at.gv.egovernment.moa.id.config.auth.IOAAuthParameters;
-import at.gv.egovernment.moa.id.moduls.IRequest;
import at.gv.egovernment.moa.util.Constants;
import at.gv.egovernment.moa.util.DateTimeUtils;
import at.gv.egovernment.moa.util.StringUtils;
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/DataURLBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/DataURLBuilder.java
index 9a2baf873..8334780ba 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/DataURLBuilder.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/DataURLBuilder.java
@@ -46,7 +46,7 @@
package at.gv.egovernment.moa.id.auth.builder;
-import at.gv.egovernment.moa.id.auth.MOAIDAuthConstants;
+import at.gv.egovernment.moa.id.commons.MOAIDAuthConstants;
/**
* Builds a DataURL parameter meant for the security layer implementation
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/DynamicOAAuthParameterBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/DynamicOAAuthParameterBuilder.java
index 8c0de1121..f4f6e82ba 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/DynamicOAAuthParameterBuilder.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/DynamicOAAuthParameterBuilder.java
@@ -28,13 +28,13 @@ import java.util.List;
import org.opensaml.saml2.core.Attribute;
import at.gv.egovernment.moa.id.auth.exception.DynamicOABuildException;
+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.exceptions.ConfigurationException;
import at.gv.egovernment.moa.id.commons.db.dao.session.InterfederationSessionStore;
-import at.gv.egovernment.moa.id.config.ConfigurationException;
import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory;
-import at.gv.egovernment.moa.id.config.auth.IOAAuthParameters;
import at.gv.egovernment.moa.id.config.auth.OAAuthParameter;
import at.gv.egovernment.moa.id.config.auth.data.DynamicOAAuthParameters;
-import at.gv.egovernment.moa.id.moduls.IRequest;
import at.gv.egovernment.moa.id.protocols.pvp2x.PVPConstants;
import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.Constants;
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/GUILayoutBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/GUILayoutBuilder.java
deleted file mode 100644
index b95cbbc16..000000000
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/GUILayoutBuilder.java
+++ /dev/null
@@ -1,157 +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.builder;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.net.URI;
-
-import org.apache.commons.io.IOUtils;
-
-import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory;
-import at.gv.egovernment.moa.id.config.auth.IOAAuthParameters;
-import at.gv.egovernment.moa.id.moduls.IRequest;
-import at.gv.egovernment.moa.id.util.FormBuildUtils;
-import at.gv.egovernment.moa.logging.Logger;
-
-/**
- * @author tlenz
- *
- */
-public class GUILayoutBuilder {
- private static final String CSS_LAYOUTTEMPLATE = "css_template.css";
- private static final String JS_LAYOUTTEMPLATE = "javascript_tempalte.js";
- private static final String HTMLTEMPLATESDIR = "htmlTemplates/";
-
- private static String CONTEXTPATH = "#CONTEXTPATH#";
- private static String MOASESSIONID = "#SESSIONID#";
- private static String AUTH_URL = "#AUTH_URL#";
- private static String BKU_ONLINE = "#ONLINE#";
- private static String BKU_HANDY = "#HANDY#";
- private static String BKU_LOCAL = "#LOCAL#";
-
-
- public static String buildCSS(IRequest pendingReq, String authURL) {
- return buildForm(pendingReq, authURL, CSS_LAYOUTTEMPLATE);
-
- }
-
- public static String buildJS(IRequest pendingReq, String authURL) {
- return buildForm(pendingReq, authURL, JS_LAYOUTTEMPLATE);
-
- }
-
-
-
- private static String getTemplate(String templateName) {
- String pathLocation;
- InputStream input = null;
- try {
- String rootconfigdir = AuthConfigurationProviderFactory.getInstance().getRootConfigFileDir();
- pathLocation = rootconfigdir + HTMLTEMPLATESDIR + templateName;
-
- try {
- File file = new File(new URI(pathLocation));
- input = new FileInputStream(file);
-
- } catch (FileNotFoundException e) {
- Logger.warn("No LoginFormTempaltes found. Use Generic Templates from package.");
- pathLocation = "resources/templates/" + templateName;
- input = Thread.currentThread()
- .getContextClassLoader()
- .getResourceAsStream(pathLocation);
-
- }
-
- return getTemplate(input);
-
- } catch (Exception e) {
- return null;
-
- } finally {
- try {
- if (input != null)
- input.close();
-
- } catch (IOException e) {
- Logger.warn("SendAssertionTemplate inputstream can not be closed.", e);
-
- }
- }
- }
-
- private static String getTemplate(InputStream input) {
- String template = null;
- try {
-
- StringWriter writer = new StringWriter();
- IOUtils.copy(input, writer);
- template = writer.toString();
-
- } catch (Exception e) {
- Logger.error("Failed to read template", e);
-
- }
- return template;
- }
-
- private static String buildForm(IRequest pendingReq, String authURL, String templateName) {
- //load default GUI-Layout template template
- String value = getTemplate(templateName);
-
- if (pendingReq != null) {
- IOAAuthParameters oaParam = pendingReq.getOnlineApplicationConfiguration();
-
- if(value != null) {
- //only for BKU-Selection step and JavaScript generation
- value = value.replace(AUTH_URL, LoginFormBuilder.SERVLET);
-
- value = value.replace(CONTEXTPATH, pendingReq.getAuthURL());
- value = value.replace(MOASESSIONID, pendingReq.getRequestID());
-
- value = value.replace(BKU_ONLINE, IOAAuthParameters.ONLINEBKU);
- value = value.replace(BKU_HANDY, IOAAuthParameters.HANDYBKU);
- value = value.replace(BKU_LOCAL, IOAAuthParameters.LOCALBKU);
-
-
- value = FormBuildUtils.customiceLayoutBKUSelection(value,
- oaParam.isShowMandateCheckBox(),
- oaParam.isOnlyMandateAllowed(),
- oaParam.getFormCustomizaten(),
- oaParam.isShowStorkLogin());
- }
-
- } else {
- value = FormBuildUtils.defaultLayoutBKUSelection(value);
- value = value.replace(CONTEXTPATH, authURL);
-
- }
-
- return value;
- }
-
-}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/LoginFormBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/LoginFormBuilder.java
deleted file mode 100644
index e1aa41ce2..000000000
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/LoginFormBuilder.java
+++ /dev/null
@@ -1,171 +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.builder;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.net.URI;
-
-import org.apache.commons.io.IOUtils;
-
-import at.gv.egovernment.moa.id.auth.MOAIDAuthConstants;
-import at.gv.egovernment.moa.id.config.ConfigurationException;
-import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory;
-import at.gv.egovernment.moa.id.config.auth.IOAAuthParameters;
-import at.gv.egovernment.moa.id.config.stork.CPEPS;
-import at.gv.egovernment.moa.id.util.FormBuildUtils;
-import at.gv.egovernment.moa.logging.Logger;
-import at.gv.egovernment.moa.util.MiscUtil;
-
-public class LoginFormBuilder {
-
- private static final String HTMLTEMPLATESDIR = "htmlTemplates/";
- private static final String HTMLTEMPLATEFULL = "loginFormFull.html";
-
- private static String AUTH_URL = "#AUTH_URL#";
- private static String OANAME = "#OAName#";
- private static String BKU_ONLINE = "#ONLINE#";
- private static String BKU_HANDY = "#HANDY#";
- private static String BKU_LOCAL = "#LOCAL#";
- public static String CONTEXTPATH = "#CONTEXTPATH#";
- private static String MOASESSIONID = "#SESSIONID#";
- private static String PEPSLIST = "#PEPSLIST#";
-
- public static String SERVLET = CONTEXTPATH+"/GenerateIframeTemplate";
-
- private static String getTemplate() {
- String pathLocation ="";
- InputStream input = null;
-
- try {
- String rootconfigdir = AuthConfigurationProviderFactory.getInstance().getRootConfigFileDir();
- pathLocation = rootconfigdir + HTMLTEMPLATESDIR + HTMLTEMPLATEFULL;
- File file = new File(new URI(pathLocation));
- input = new FileInputStream(file);
-
- } catch (ConfigurationException e) {
- Logger.warn("MOA-ID configuration can not be loaded.");
-
- } catch (Exception e) {
-
- }
-
- return getTemplate(input);
-
- }
-
- public static String getTemplate(InputStream input) {
-
- String template = null;
-
- try {
- if (input == null) {
-
- Logger.warn("No LoginFormTempaltes found. Use Generic Templates from package.");
-
- String pathLocation = "resources/templates/" + HTMLTEMPLATEFULL;
- input = Thread.currentThread()
- .getContextClassLoader()
- .getResourceAsStream(pathLocation);
-
- }
-
- StringWriter writer = new StringWriter();
- IOUtils.copy(input, writer);
- template = writer.toString();
- template = template.replace(AUTH_URL, SERVLET);
- template = template.replace(BKU_ONLINE, IOAAuthParameters.ONLINEBKU);
- template = template.replace(BKU_HANDY, IOAAuthParameters.HANDYBKU);
- template = template.replace(BKU_LOCAL, IOAAuthParameters.LOCALBKU);
-
- } catch (Exception e) {
- Logger.error("Failed to read template", e);
-
- } finally {
- try {
- input.close();
-
- } catch (IOException e) {
- Logger.warn("SendAssertionTemplate inputstream can not be closed.", e);
- }
- }
- return template;
- }
-
- public static String buildLoginForm(String modul, String action, IOAAuthParameters oaParam, String contextpath, String moaSessionID) {
-
- String value = null;
-
- byte[] oatemplate = oaParam.getBKUSelectionTemplate();
- // OA specific template requires a size of 8 bits minimum
- if (oatemplate != null && oatemplate.length > 7) {
- InputStream is = new ByteArrayInputStream(oatemplate);
- value = getTemplate(is);
-
- } else {
- //load default BKU-selection template
- value = getTemplate();
-
- }
-
- if(value != null) {
- value = value.replace(OANAME, oaParam.getFriendlyName());
- value = value.replace(CONTEXTPATH, contextpath);
- value = value.replace(MOASESSIONID, moaSessionID);
-
- if (oaParam.isShowStorkLogin()) {
- String pepslist = "";
- try {
- for (CPEPS current : oaParam.getPepsList()) {
- String countryName = null;
- if (MiscUtil.isNotEmpty(MOAIDAuthConstants.COUNTRYCODE_XX_TO_NAME.get(current.getCountryCode().toUpperCase())))
- countryName = MOAIDAuthConstants.COUNTRYCODE_XX_TO_NAME.get(current.getCountryCode().toUpperCase());
- else
- countryName = current.getCountryCode().toUpperCase();
-
- pepslist += "<option value=" + current.getCountryCode() + ">"
- + countryName
- + "</option>\n";
-
- }
- value = value.replace(PEPSLIST, pepslist);
-
- } catch (NullPointerException e) {
-
- }
- }
-
- value = FormBuildUtils.customiceLayoutBKUSelection(value,
- oaParam.isShowMandateCheckBox(),
- oaParam.isOnlyMandateAllowed(),
- oaParam.getFormCustomizaten(),
- oaParam.isShowStorkLogin());
-
- }
- return value;
- }
-}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/RedirectFormBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/RedirectFormBuilder.java
deleted file mode 100644
index 2a5c8d418..000000000
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/RedirectFormBuilder.java
+++ /dev/null
@@ -1,65 +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.builder;
-
-import java.io.InputStream;
-import java.io.StringWriter;
-
-import org.apache.commons.io.IOUtils;
-
-import at.gv.egovernment.moa.logging.Logger;
-
-public class RedirectFormBuilder {
-
- private static String URL = "#URL#";
- private static String TARGET = "#TARGET#";
- private static String template;
-
- private static String getTemplate() {
-
- if (template == null) {
- try {
- String classpathLocation = "resources/templates/redirectForm.html";
- InputStream input = Thread.currentThread()
- .getContextClassLoader()
- .getResourceAsStream(classpathLocation);
- StringWriter writer = new StringWriter();
- IOUtils.copy(input, writer);
- template = writer.toString();
- } catch (Exception e) {
- Logger.error("Failed to read template", e);
- }
- }
-
- return template;
- }
-
- public static String buildLoginForm(String url, String redirectTarget) {
- String value = getTemplate();
- value = value.replace(URL, url);
- value = value.replace(TARGET, redirectTarget);
-
- return value;
- }
-
-}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/SendAssertionFormBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/SendAssertionFormBuilder.java
deleted file mode 100644
index 7121935b0..000000000
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/SendAssertionFormBuilder.java
+++ /dev/null
@@ -1,147 +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.builder;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.net.URI;
-
-import org.apache.commons.io.IOUtils;
-
-import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory;
-import at.gv.egovernment.moa.id.config.auth.IOAAuthParameters;
-import at.gv.egovernment.moa.id.moduls.IRequest;
-import at.gv.egovernment.moa.id.util.FormBuildUtils;
-import at.gv.egovernment.moa.logging.Logger;
-
-public class SendAssertionFormBuilder {
-
- private static final String HTMLTEMPLATESDIR = "htmlTemplates/";
- private static final String HTMLTEMPLATEFULL = "sendAssertionFormFull.html";
-
- private static final String TEMPLATEBGCOLOR = "style=\"background-color: #COLOR#\"";
-
- private static String URL = "#URL#";
- private static String ID = "#ID#";
- private static String OANAME = "#OAName#";
- private static String CONTEXTPATH = "#CONTEXTPATH#";
- private static String BACKGROUNDCOLOR = "#BACKGROUNDCOLOR#";
- private static String COLOR = "#COLOR#";
-
- private static String SERVLET = CONTEXTPATH+"/SSOSendAssertionServlet";
-
- private static String getTemplate() {
- String pathLocation;
- InputStream input = null;
- try {
- String rootconfigdir = AuthConfigurationProviderFactory.getInstance().getRootConfigFileDir();
- pathLocation = rootconfigdir + HTMLTEMPLATESDIR + HTMLTEMPLATEFULL;
-
- try {
- File file = new File(new URI(pathLocation));
- input = new FileInputStream(file);
-
- } catch (FileNotFoundException e) {
- Logger.warn("No LoginFormTempaltes found. Use Generic Templates from package.");
- pathLocation = "resources/templates/" + HTMLTEMPLATEFULL;
- input = Thread.currentThread()
- .getContextClassLoader()
- .getResourceAsStream(pathLocation);
-
- }
-
- return getTemplate(input);
-
- } catch (Exception e) {
- return null;
-
- } finally {
- try {
- if (input != null)
- input.close();
-
- } catch (IOException e) {
- Logger.warn("SendAssertionTemplate inputstream can not be closed.", e);
-
- }
- }
- }
-
- private static String getTemplate(InputStream input) {
- String template = null;
- try {
-
- StringWriter writer = new StringWriter();
- IOUtils.copy(input, writer);
- template = writer.toString();
- template = template.replace(URL, SERVLET);
-
- } catch (Exception e) {
- Logger.error("Failed to read template", e);
-
- }
- return template;
- }
-
- public static String buildForm(IRequest pendingReq) {
- String value = null;
-
- String contextpath = pendingReq.getAuthURL();
- IOAAuthParameters oaParam = pendingReq.getOnlineApplicationConfiguration();
-
- byte[] oatemplate = oaParam.getSendAssertionTemplate();
- // OA specific template requires a size of 8 bits minimum
- if (oatemplate != null && oatemplate.length > 7) {
- InputStream is = new ByteArrayInputStream(oatemplate);
- value = getTemplate(is);
-
- } else {
- //load default BKU-selection template
- value = getTemplate();
-
- }
-
- if(value != null) {
- value = value.replace(ID, pendingReq.getRequestID());
- value = value.replace(OANAME, oaParam.getFriendlyName());
-
- if (contextpath.endsWith("/"))
- contextpath = contextpath.substring(0, contextpath.length() - 1);
- value = value.replace(CONTEXTPATH, contextpath);
-
- value = FormBuildUtils.customiceLayoutBKUSelection(value,
- oaParam.isShowMandateCheckBox(),
- oaParam.isOnlyMandateAllowed(),
- oaParam.getFormCustomizaten(),
- oaParam.isShowStorkLogin());
-
- }
- return value;
- }
-
-}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/SignatureVerificationUtils.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/SignatureVerificationUtils.java
index f2e4da818..ec94101d1 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/SignatureVerificationUtils.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/SignatureVerificationUtils.java
@@ -31,11 +31,11 @@ import org.w3c.dom.Node;
import at.gv.egovernment.moa.id.auth.data.VerifyXMLSignatureResponse;
import at.gv.egovernment.moa.id.auth.exception.BuildException;
-import at.gv.egovernment.moa.id.auth.exception.MOAIDException;
import at.gv.egovernment.moa.id.auth.exception.ParseException;
import at.gv.egovernment.moa.id.auth.exception.ServiceException;
import at.gv.egovernment.moa.id.auth.invoke.SignatureVerificationInvoker;
import at.gv.egovernment.moa.id.auth.parser.VerifyXMLSignatureResponseParser;
+import at.gv.egovernment.moa.id.commons.api.exceptions.MOAIDException;
import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.Base64Utils;
import at.gv.egovernment.moa.util.Constants;