aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool
diff options
context:
space:
mode:
authorBojan Suzic <bojan.suzic@iaik.tugraz.at>2014-04-03 12:30:30 +0200
committerBojan Suzic <bojan.suzic@iaik.tugraz.at>2014-04-03 12:30:30 +0200
commita4a715f1124282e202fb2e56f874a8c1a5e2bd71 (patch)
tree2c43e82874507646e1a31d3b5f1077c2f76cc141 /id/ConfigWebTool
parent996c5877797949948fbb709d8b2dfc420eda8ddd (diff)
parentf69a970246ff82e7d08c96430b2a281416df4d15 (diff)
downloadmoa-id-spss-a4a715f1124282e202fb2e56f874a8c1a5e2bd71.tar.gz
moa-id-spss-a4a715f1124282e202fb2e56f874a8c1a5e2bd71.tar.bz2
moa-id-spss-a4a715f1124282e202fb2e56f874a8c1a5e2bd71.zip
Merge branch 'moa-2.1-Snapshot' of gitlab.iaik.tugraz.at:afitzek/moa-idspss into vidp_2.1_bs
Diffstat (limited to 'id/ConfigWebTool')
-rw-r--r--id/ConfigWebTool/pom.xml29
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/Constants.java4
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java46
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/exception/BasicActionException.java44
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicAction.java106
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java61
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java216
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ImportExportAction.java66
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java145
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ListOAsAction.java64
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/MainAction.java60
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/OpenAdminRequestsAction.java37
-rw-r--r--id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/UserManagementAction.java94
-rw-r--r--id/ConfigWebTool/src/main/resources/applicationResources_en.properties6
-rw-r--r--id/ConfigWebTool/src/main/resources/struts.xml30
-rw-r--r--id/ConfigWebTool/src/main/webapp/WEB-INF/web.xml2
-rw-r--r--id/ConfigWebTool/src/main/webapp/css/index.css7
-rw-r--r--id/ConfigWebTool/src/main/webapp/index.jsp4
-rw-r--r--id/ConfigWebTool/src/main/webapp/jsp/snippets/footer.jsp2
19 files changed, 520 insertions, 503 deletions
diff --git a/id/ConfigWebTool/pom.xml b/id/ConfigWebTool/pom.xml
index 36fe03457..57aa5c794 100644
--- a/id/ConfigWebTool/pom.xml
+++ b/id/ConfigWebTool/pom.xml
@@ -139,18 +139,23 @@
<type>jar</type>
<scope>compile</scope>
</dependency>
-<!-- <dependency>
- <groupId>iaik</groupId>
- <artifactId>commons-iaik</artifactId>
- <version>0.7.1</version>
- <exclusions>
- <exclusion>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency> -->
-
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <version>${project.version}</version>
+ </manifestEntries>
+ </archive>
+ </configuration>
+</plugin>
+ </plugins>
+ </build>
+
</project>
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/Constants.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/Constants.java
index 513f046f1..69ac58d15 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/Constants.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/Constants.java
@@ -22,13 +22,15 @@
*******************************************************************************/
package at.gv.egovernment.moa.id.configuration;
-import java.util.Collection;
import java.util.Hashtable;
import java.util.Map;
import edu.emory.mathcs.backport.java.util.Collections;
public class Constants {
+
+ public static final String DEFAULT_VERSION = "1.x";
+
public static final String FILEPREFIX = "file:";
public static final String SERVLET_PVP2ASSERTION = "pvp2login.action";
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java
index e4cf5367d..e65163946 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/config/ConfigurationProvider.java
@@ -29,12 +29,15 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URL;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.util.Properties;
import java.util.Timer;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
import javax.servlet.http.HttpServletRequest;
@@ -51,6 +54,7 @@ import at.gv.egovernment.moa.id.configuration.Constants;
import at.gv.egovernment.moa.id.configuration.auth.pvp2.MetaDataVerificationFilter;
import at.gv.egovernment.moa.id.configuration.exception.ConfigurationException;
import at.gv.egovernment.moa.id.configuration.utils.UserRequestCleaner;
+import at.gv.egovernment.moa.id.protocols.pvp2x.config.PVPConfiguration;
import at.gv.egovernment.moa.util.MiscUtil;
@@ -445,6 +449,9 @@ public class ConfigurationProvider {
return props.getProperty("general.mail.admin.adress");
}
+ public String getConfigToolVersion() {
+ return parseVersionFromManifest();
+ }
private void initalPVP2Login() throws ConfigurationException {
try {
@@ -480,6 +487,45 @@ public class ConfigurationProvider {
} catch (Exception e) {
log.warn("PVP2 authentification can not be initialized.");
throw new ConfigurationException("PVP2 authentification can not be initialized.", e);
+ }
+ }
+
+ private String parseVersionFromManifest() {
+
+
+
+ try {
+ Class clazz = ConfigurationProvider.class;
+ String className = clazz.getSimpleName() + ".class";
+ String classPath = clazz.getResource(className).toString();
+
+ if (classPath.startsWith("jar")) {
+ log.info("MOA-ID-Configuration Version can NOT parsed from Manifest. Set blank Version");
+ return Constants.DEFAULT_VERSION;
+
+ }
+
+ String manifestPath = classPath.substring(0, classPath.lastIndexOf("WEB-INF/classes/") + "WEB-INF/classes/".length()) +
+ "../../META-INF/MANIFEST.MF";
+
+ Manifest manifest = new Manifest(new URL(manifestPath).openStream());;
+
+ Attributes attributes = manifest.getMainAttributes();
+ String version = attributes.getValue("version");
+
+ if (MiscUtil.isNotEmpty(version))
+ return version;
+
+ else {
+ log.info("MOA-ID-Configuration Version not found in Manifest. Set blank Version");
+ return Constants.DEFAULT_VERSION;
+
+ }
+
+ } catch (Throwable e) {
+ log.info("MOA-ID Version can NOT parsed from Manifest. Set blank Version");
+
+ return Constants.DEFAULT_VERSION;
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/exception/BasicActionException.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/exception/BasicActionException.java
new file mode 100644
index 000000000..9a646c6c6
--- /dev/null
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/exception/BasicActionException.java
@@ -0,0 +1,44 @@
+/*
+ * 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.configuration.exception;
+
+/**
+ * @author tlenz
+ *
+ */
+public class BasicActionException extends Exception {
+
+ private static final long serialVersionUID = -5885513840231902243L;
+ public BasicActionException(String errorname) {
+ super(errorname);
+ }
+
+ public BasicActionException(String errorname, Throwable e) {
+ super(errorname + " (" + e.getLocalizedMessage() + ")");
+ }
+
+ public BasicActionException(Throwable e) {
+ super(e.getLocalizedMessage());
+ }
+
+}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicAction.java
new file mode 100644
index 000000000..67bd13dd2
--- /dev/null
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/BasicAction.java
@@ -0,0 +1,106 @@
+/*
+ * 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.configuration.struts.action;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.log4j.Logger;
+import org.apache.struts2.interceptor.ServletRequestAware;
+import org.apache.struts2.interceptor.ServletResponseAware;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+import at.gv.egovernment.moa.id.configuration.Constants;
+import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
+import at.gv.egovernment.moa.id.configuration.config.ConfigurationProvider;
+import at.gv.egovernment.moa.id.configuration.exception.BasicActionException;
+import at.gv.egovernment.moa.id.configuration.exception.ConfigurationException;
+import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper;
+
+/**
+ * @author tlenz
+ *
+ */
+public class BasicAction extends ActionSupport implements ServletRequestAware,
+ ServletResponseAware {
+
+ private static final long serialVersionUID = 7478261301859056771L;
+ private static Logger log = Logger.getLogger(BasicAction.class);
+
+ protected HttpServletRequest request;
+ protected HttpServletResponse response;
+ protected ConfigurationProvider configuration = null;
+ protected AuthenticatedUser authUser = null;
+ protected HttpSession session = null;
+
+ protected void populateBasicInformations() throws BasicActionException {
+ try {
+ configuration = ConfigurationProvider.getInstance();
+
+ session = request.getSession();
+ Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
+ if (authUserObj instanceof AuthenticatedUser)
+ authUser = (AuthenticatedUser) authUserObj;
+
+ } catch (ConfigurationException e) {
+ log.warn("An internal error occurs.", e);
+ addActionError(LanguageHelper.getErrorString("error.login.internal", request));
+ throw new BasicActionException(LanguageHelper.getErrorString("error.login.internal", request), e);
+
+ }
+ }
+
+ public String getConfigToolVersion() {
+ return configuration.getConfigToolVersion();
+ }
+
+ /**
+ * @return the authUser
+ */
+ public AuthenticatedUser getAuthUser() {
+ return authUser;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.struts2.interceptor.ServletResponseAware#setServletResponse(javax.servlet.http.HttpServletResponse)
+ */
+ @Override
+ public void setServletResponse(HttpServletResponse arg0) {
+ this.response = arg0;
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.struts2.interceptor.ServletRequestAware#setServletRequest(javax.servlet.http.HttpServletRequest)
+ */
+ @Override
+ public void setServletRequest(HttpServletRequest arg0) {
+ this.request = arg0;
+
+ }
+
+
+
+}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java
index 5bb3f5143..b2bf58f1a 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditGeneralConfigAction.java
@@ -69,6 +69,7 @@ import at.gv.egovernment.moa.id.configuration.Constants;
import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
import at.gv.egovernment.moa.id.configuration.data.GeneralMOAIDConfig;
import at.gv.egovernment.moa.id.configuration.data.GeneralStorkConfig;
+import at.gv.egovernment.moa.id.configuration.exception.BasicActionException;
import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper;
import at.gv.egovernment.moa.id.configuration.helper.StringHelper;
import at.gv.egovernment.moa.id.configuration.validation.ValidationHelper;
@@ -79,30 +80,24 @@ import at.gv.egovernment.moa.util.MiscUtil;
import com.opensymphony.xwork2.ActionSupport;
-public class EditGeneralConfigAction extends ActionSupport
- implements ServletRequestAware, ServletResponseAware {
-
- private static final Logger log = Logger.getLogger(EditGeneralConfigAction.class);
+public class EditGeneralConfigAction extends BasicAction {
+ private static final Logger log = Logger.getLogger(EditGeneralConfigAction.class);
private static final long serialVersionUID = 1L;
- private HttpServletRequest request;
-
- private AuthenticatedUser authUser;
+
private GeneralMOAIDConfig moaconfig;
private GeneralStorkConfig storkconfig;
private String formID;
public String loadConfig() {
-
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+
}
-
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
- authUser = (AuthenticatedUser) authUserObj;
if (authUser.isAdmin()) {
@@ -135,14 +130,13 @@ public class EditGeneralConfigAction extends ActionSupport
}
public String saveConfig() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+
}
-
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
- authUser = (AuthenticatedUser) authUserObj;
Object formidobj = session.getAttribute(Constants.SESSION_FORMID);
if (formidobj != null && formidobj instanceof String) {
@@ -196,10 +190,13 @@ public class EditGeneralConfigAction extends ActionSupport
}
public String back() {
-
- Object authUserObj = request.getSession().getAttribute(Constants.SESSION_AUTH);
-
- authUser = (AuthenticatedUser) authUserObj;
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
+ }
return Constants.STRUTS_SUCCESS;
}
@@ -657,22 +654,6 @@ public class EditGeneralConfigAction extends ActionSupport
return null;
}
-
- public void setServletResponse(HttpServletResponse response) {
-// this.response = response;
- }
-
- public void setServletRequest(HttpServletRequest request) {
- this.request = request;
-
- }
-
- /**
- * @return the authUser
- */
- public AuthenticatedUser getAuthUser() {
- return authUser;
- }
/**
* @return the moaconfig
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java
index 2e8ec29de..4830ffb71 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/EditOAAction.java
@@ -32,6 +32,7 @@ import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
import at.gv.egovernment.moa.id.configuration.config.ConfigurationProvider;
import at.gv.egovernment.moa.id.configuration.data.FormularCustomization;
import at.gv.egovernment.moa.id.configuration.data.oa.*;
+import at.gv.egovernment.moa.id.configuration.exception.BasicActionException;
import at.gv.egovernment.moa.id.configuration.exception.ConfigurationException;
import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper;
import at.gv.egovernment.moa.id.configuration.helper.MailHelper;
@@ -57,17 +58,11 @@ import java.math.BigInteger;
import java.security.cert.CertificateException;
import java.util.*;
-public class EditOAAction extends ActionSupport implements ServletRequestAware, ServletResponseAware {
+public class EditOAAction extends BasicAction {
private final Logger log = Logger.getLogger(EditOAAction.class);
-
private static final long serialVersionUID = 1L;
- private HttpServletRequest request;
- private HttpServletResponse response;
-
- private AuthenticatedUser authUser;
-
private String oaidobj;
private boolean newOA;
private String formID;
@@ -96,15 +91,13 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
// STRUTS actions
public String inital() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
- return Constants.STRUTS_ERROR;
- }
-
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
-
- authUser = (AuthenticatedUser) authUserObj;
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
+ }
long oaid = -1;
@@ -183,19 +176,17 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
public String newOA() {
log.debug("insert new Online-Application");
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
- return Constants.STRUTS_ERROR;
- }
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
+ }
session.setAttribute(Constants.SESSION_OAID, null);
nextPage = Constants.STRUTS_RETURNAREA_VALUES.main.name();
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
-
- authUser = (AuthenticatedUser) authUserObj;
-
UserDatabase userdb = ConfigurationDBRead.getUserWithID(authUser.getUserID());
if (!authUser.isAdmin() && userdb.isIsMailAddressVerified() != null && !userdb.isIsMailAddressVerified()) {
@@ -236,14 +227,13 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
}
public String saveOA() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
- return Constants.STRUTS_ERROR;
- }
-
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
- authUser = (AuthenticatedUser) authUserObj;
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
+ }
Object formidobj = session.getAttribute(Constants.SESSION_FORMID);
if (formidobj != null && formidobj instanceof String) {
@@ -507,12 +497,13 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
}
public String cancleAndBackOA() {
-
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
- return Constants.STRUTS_ERROR;
- }
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
+ }
Object nextPageAttr = session.getAttribute(Constants.SESSION_RETURNAREA);
if (nextPageAttr != null && nextPageAttr instanceof String) {
@@ -533,14 +524,13 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
}
public String deleteOA() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
- return Constants.STRUTS_ERROR;
- }
-
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
- authUser = (AuthenticatedUser) authUserObj;
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
+ }
Object formidobj = session.getAttribute(Constants.SESSION_FORMID);
if (formidobj != null && formidobj instanceof String) {
@@ -648,75 +638,75 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
String preview = null;
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
- preview = LanguageHelper.getErrorString("error.bkuformpreview.notpossible", request);
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
+ }
+ InputStream input = null;
- } else {
- InputStream input = null;
-
- try {
- Object mapobj = session.getAttribute(Constants.SESSION_BKUFORMPREVIEW);
- if (mapobj != null && mapobj instanceof Map<?, ?>) {
+ try {
+ Object mapobj = session.getAttribute(Constants.SESSION_BKUFORMPREVIEW);
+ if (mapobj != null && mapobj instanceof Map<?, ?>) {
- ConfigurationProvider config = ConfigurationProvider.getInstance();
- String templateURL = config.getConfigRootDir() + ConfigurationProvider.HTMLTEMPLATE_DIR
- + ConfigurationProvider.HTMLTEMPLATE_FILE;
+ ConfigurationProvider config = ConfigurationProvider.getInstance();
+ String templateURL = config.getConfigRootDir() + ConfigurationProvider.HTMLTEMPLATE_DIR
+ + ConfigurationProvider.HTMLTEMPLATE_FILE;
- File file = new File(templateURL);
- input = new FileInputStream(file);
+ File file = new File(templateURL);
+ input = new FileInputStream(file);
- String contextpath = config.getMOAIDInstanceURL();
- if (MiscUtil.isEmpty(contextpath)) {
- log.info("NO MOA-ID instance URL configurated.");
- throw new ConfigurationException("No MOA-ID instance configurated");
- }
+ String contextpath = config.getMOAIDInstanceURL();
+ if (MiscUtil.isEmpty(contextpath)) {
+ log.info("NO MOA-ID instance URL configurated.");
+ throw new ConfigurationException("No MOA-ID instance configurated");
+ }
- preview = LoginFormBuilder.getTemplate(input);
- preview = preview.replace(LoginFormBuilder.CONTEXTPATH, contextpath);
+ preview = LoginFormBuilder.getTemplate(input);
+ preview = preview.replace(LoginFormBuilder.CONTEXTPATH, contextpath);
- Map<String, String> map = (Map<String, String>) mapobj;
+ Map<String, String> map = (Map<String, String>) mapobj;
- request.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
- String module = request.getParameter(Constants.REQUEST_FORMCUSTOM_MODULE);
- String value = request.getParameter(Constants.REQUEST_FORMCUSTOM_VALUE);
+ String module = request.getParameter(Constants.REQUEST_FORMCUSTOM_MODULE);
+ String value = request.getParameter(Constants.REQUEST_FORMCUSTOM_VALUE);
- if (value != null) {
- String[] query = URLDecoder.decode(request.getQueryString()).split("&");
- value = query[1].substring("value=".length());
- }
+ if (value != null) {
+ String[] query = URLDecoder.decode(request.getQueryString()).split("&");
+ value = query[1].substring("value=".length());
+ }
- synchronized (map) {
+ synchronized (map) {
- if (MiscUtil.isNotEmpty(module)) {
- if (map.containsKey("#" + module + "#")) {
- if (MiscUtil.isNotEmpty(value)) {
- if (FormBuildUtils.FONTFAMILY.contains(module) || FormBuildUtils.HEADER_TEXT.contains(module)
- || value.startsWith("#"))
- map.put("#" + module + "#", value);
- else
- map.put("#" + module + "#", "#" + value);
+ if (MiscUtil.isNotEmpty(module)) {
+ if (map.containsKey("#" + module + "#")) {
+ if (MiscUtil.isNotEmpty(value)) {
+ if (FormBuildUtils.FONTFAMILY.contains(module) || FormBuildUtils.HEADER_TEXT.contains(module)
+ || value.startsWith("#"))
+ map.put("#" + module + "#", value);
+ else
+ map.put("#" + module + "#", "#" + value);
- } else {
- map.put("#" + module + "#", FormBuildUtils.getDefaultMap().get("#" + module + "#"));
- }
+ } else {
+ map.put("#" + module + "#", FormBuildUtils.getDefaultMap().get("#" + module + "#"));
}
}
- preview = FormBuildUtils.customiceLayoutBKUSelection(preview, true, false, map, true);
}
-
- } else {
- preview = LanguageHelper.getErrorString("error.bkuformpreview.notpossible", request);
-
+ preview = FormBuildUtils.customiceLayoutBKUSelection(preview, true, false, map, true);
}
- } catch (Exception e) {
- log.warn("BKUSelection Preview can not be generated.", e);
+ } else {
preview = LanguageHelper.getErrorString("error.bkuformpreview.notpossible", request);
}
+
+ } catch (Exception e) {
+ log.warn("BKUSelection Preview can not be generated.", e);
+ preview = LanguageHelper.getErrorString("error.bkuformpreview.notpossible", request);
+
}
stream = new ByteArrayInputStream(preview.getBytes());
@@ -1132,33 +1122,6 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
return Constants.STRUTS_SUCCESS;
}
- // Getter and Setter
- public void setServletResponse(HttpServletResponse arg0) {
- this.response = arg0;
-
- }
-
- public void setServletRequest(HttpServletRequest arg0) {
- this.request = arg0;
-
- }
-
- public HttpServletRequest getRequest() {
- return request;
- }
-
- public void setRequest(HttpServletRequest request) {
- this.request = request;
- }
-
- public HttpServletResponse getResponse() {
- return response;
- }
-
- public void setResponse(HttpServletResponse response) {
- this.response = response;
- }
-
public OAGeneralConfig getGeneralOA() {
return generalOA;
}
@@ -1207,13 +1170,6 @@ public class EditOAAction extends ActionSupport implements ServletRequestAware,
}
/**
- * @return the authUser
- */
- public AuthenticatedUser getAuthUser() {
- return authUser;
- }
-
- /**
* @return the newOA
*/
public boolean isNewOA() {
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ImportExportAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ImportExportAction.java
index fb2a931fd..84093cc7a 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ImportExportAction.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ImportExportAction.java
@@ -51,23 +51,18 @@ import at.gv.egovernment.moa.id.config.legacy.BuildFromLegacyConfig;
import at.gv.egovernment.moa.id.configuration.Constants;
import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
import at.gv.egovernment.moa.id.configuration.config.ConfigurationProvider;
+import at.gv.egovernment.moa.id.configuration.exception.BasicActionException;
import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper;
import at.gv.egovernment.moa.id.util.Random;
import com.opensymphony.xwork2.ActionSupport;
-public class ImportExportAction extends ActionSupport
-implements ServletRequestAware, ServletResponseAware {
+public class ImportExportAction extends BasicAction {
private static final Logger log = Logger.getLogger(ImportExportAction.class);
-
private static final long serialVersionUID = 1L;
- private HttpServletRequest request;
-// private HttpServletResponse response;
- private AuthenticatedUser authUser;
private String formID;
-
private File fileUpload = null;
private String fileUploadContentType = null;
private String fileUploadFileName = null;
@@ -75,15 +70,14 @@ implements ServletRequestAware, ServletResponseAware {
private InputStream fileInputStream;
public String init() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+
}
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
- authUser = (AuthenticatedUser) authUserObj;
-
if (authUser.isAdmin()) {
formID = Random.nextRandom();
@@ -99,15 +93,14 @@ implements ServletRequestAware, ServletResponseAware {
}
public String importLegacyConfig() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+
}
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
- authUser = (AuthenticatedUser) authUserObj;
-
Object formidobj = session.getAttribute(Constants.SESSION_FORMID);
if (formidobj != null && formidobj instanceof String) {
String formid = (String) formidobj;
@@ -214,15 +207,14 @@ implements ServletRequestAware, ServletResponseAware {
}
public String downloadXMLConfig() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+
}
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
- authUser = (AuthenticatedUser) authUserObj;
-
Object formidobj = session.getAttribute(Constants.SESSION_FORMID);
if (formidobj != null && formidobj instanceof String) {
String formid = (String) formidobj;
@@ -304,15 +296,14 @@ implements ServletRequestAware, ServletResponseAware {
public String importXMLConfig() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+
}
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
- authUser = (AuthenticatedUser) authUserObj;
-
Object formidobj = session.getAttribute(Constants.SESSION_FORMID);
if (formidobj != null && formidobj instanceof String) {
String formid = (String) formidobj;
@@ -449,19 +440,6 @@ implements ServletRequestAware, ServletResponseAware {
this.fileUploadFileName = fileUploadFileName;
}
- /**
- * @return the authUser
- */
- public AuthenticatedUser getAuthUser() {
- return authUser;
- }
-
- public void setServletResponse(HttpServletResponse response) {
-// this.response = response;
- }
- public void setServletRequest(HttpServletRequest request) {
- this.request = request;
- }
public InputStream getFileInputStream() {
return fileInputStream;
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java
index 78812769f..d04592aa3 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/IndexAction.java
@@ -32,13 +32,10 @@ import java.util.Locale;
import java.util.Map.Entry;
import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.log4j.Logger;
-import org.apache.struts2.interceptor.ServletRequestAware;
-import org.apache.struts2.interceptor.ServletResponseAware;
import org.joda.time.DateTime;
import org.opensaml.common.SAMLObject;
import org.opensaml.common.binding.BasicSAMLMessageContext;
@@ -52,8 +49,6 @@ import org.opensaml.saml2.core.NameID;
import org.opensaml.saml2.core.Response;
import org.opensaml.saml2.core.StatusCode;
import org.opensaml.saml2.core.Subject;
-import org.opensaml.saml2.core.SubjectConfirmation;
-import org.opensaml.saml2.core.SubjectConfirmationData;
import org.opensaml.saml2.encryption.Decrypter;
import org.opensaml.saml2.encryption.EncryptedElementTypeEncryptedKeyResolver;
import org.opensaml.saml2.metadata.IDPSSODescriptor;
@@ -93,6 +88,7 @@ import at.gv.egovernment.moa.id.configuration.Constants;
import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
import at.gv.egovernment.moa.id.configuration.config.ConfigurationProvider;
import at.gv.egovernment.moa.id.configuration.data.UserDatabaseFrom;
+import at.gv.egovernment.moa.id.configuration.exception.BasicActionException;
import at.gv.egovernment.moa.id.configuration.exception.ConfigurationException;
import at.gv.egovernment.moa.id.configuration.helper.AuthenticationHelper;
import at.gv.egovernment.moa.id.configuration.helper.DateTimeHelper;
@@ -103,70 +99,65 @@ import at.gv.egovernment.moa.id.protocols.pvp2x.PVPConstants;
import at.gv.egovernment.moa.id.util.Random;
import at.gv.egovernment.moa.util.MiscUtil;
-public class IndexAction extends ActionSupport implements ServletRequestAware,
- ServletResponseAware {
+public class IndexAction extends BasicAction {
+ /**
+ * @throws ConfigurationException
+ */
+
private static final long serialVersionUID = -2781497863862504896L;
private static final Logger log = Logger.getLogger(IndexAction.class);
- private HttpServletRequest request;
-// private HttpServletResponse response;
-
private String password;
private String username;
private UserDatabaseFrom user = null;
- private AuthenticatedUser authUser = null;
private String formID;
private String ssologouturl;
private boolean pvp2LoginActiv = false;
+ public IndexAction() throws BasicActionException {
+ super();
+ }
+
public String start() {
-
try {
- ConfigurationProvider config = ConfigurationProvider.getInstance();
- pvp2LoginActiv = config.isPVP2LoginActive();
-
- if (request.getSession().getAttribute(Constants.SESSION_I18n) == null)
- request.getSession().setAttribute(Constants.SESSION_I18n,
- Locale.forLanguageTag(config.getDefaultLanguage()));
+ populateBasicInformations();
- if (config.isLoginDeaktivated()) {
- return "loginWithOutAuth";
-
- } else {
- return Constants.STRUTS_SUCCESS;
-
- }
-
- } catch (ConfigurationException e) {
- log.warn("An internal error occurs.", e);
- addActionError(LanguageHelper.getErrorString("error.login.internal", request));
+ } catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+
}
- }
-
- public String changeLanguage() {
-
- return Constants.STRUTS_SUCCESS;
+
+ pvp2LoginActiv = configuration.isPVP2LoginActive();
+
+ if (session.getAttribute(Constants.SESSION_I18n) == null)
+ session.setAttribute(Constants.SESSION_I18n,
+ Locale.forLanguageTag(configuration.getDefaultLanguage()));
+
+ if (configuration.isLoginDeaktivated()) {
+ return "loginWithOutAuth";
+
+ } else {
+ return Constants.STRUTS_SUCCESS;
+
+ }
}
public String authenticate() {
- ConfigurationProvider config;
try {
- config = ConfigurationProvider.getInstance();
- pvp2LoginActiv = config.isPVP2LoginActive();
-
- } catch (ConfigurationException e1) {
- log.warn("An internal error occurs.", e1);
- pvp2LoginActiv = false;
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
}
-
-
+ pvp2LoginActiv = configuration.isPVP2LoginActive();
+
String key = null;
if (MiscUtil.isNotEmpty(username)) {
@@ -262,8 +253,15 @@ public class IndexAction extends ActionSupport implements ServletRequestAware,
public String pvp2login() {
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
+ }
+
String method = request.getMethod();
- HttpSession session = request.getSession();
if (session == null) {
log.info("NO HTTP Session");
return Constants.STRUTS_ERROR;
@@ -273,10 +271,9 @@ public class IndexAction extends ActionSupport implements ServletRequestAware,
session.setAttribute(Constants.SESSION_PVP2REQUESTID, null);
if (method.equals("POST")) {
-
+
try {
- ConfigurationProvider config = ConfigurationProvider.getInstance();
- pvp2LoginActiv = config.isPVP2LoginActive();
+ pvp2LoginActiv = configuration.isPVP2LoginActive();
//Decode with HttpPost Binding
HTTPPostDecoder decode = new HTTPPostDecoder(new BasicParserPool());
@@ -301,7 +298,7 @@ public class IndexAction extends ActionSupport implements ServletRequestAware,
}
//check response destination
- String serviceURL = config.getPublicUrlPreFix(request);
+ String serviceURL = configuration.getPublicUrlPreFix(request);
if (!serviceURL.endsWith("/"))
serviceURL = serviceURL + "/";
@@ -334,11 +331,11 @@ public class IndexAction extends ActionSupport implements ServletRequestAware,
keyInfoProvider);
MetadataCredentialResolverFactory credentialResolverFactory = MetadataCredentialResolverFactory.getFactory();
- MetadataCredentialResolver credentialResolver = credentialResolverFactory.getInstance(config.getMetaDataProvier());
+ MetadataCredentialResolver credentialResolver = credentialResolverFactory.getInstance(configuration.getMetaDataProvier());
CriteriaSet criteriaSet = new CriteriaSet();
criteriaSet.add(new MetadataCriteria(IDPSSODescriptor.DEFAULT_ELEMENT_NAME, SAMLConstants.SAML20P_NS));
- criteriaSet.add(new EntityIDCriteria(config.getPVP2IDPMetadataEntityName()));
+ criteriaSet.add(new EntityIDCriteria(configuration.getPVP2IDPMetadataEntityName()));
criteriaSet.add(new UsageCriteria(UsageType.SIGNING));
ExplicitKeySignatureTrustEngine trustEngine = new ExplicitKeySignatureTrustEngine(credentialResolver, keyInfoResolver);
@@ -357,12 +354,12 @@ public class IndexAction extends ActionSupport implements ServletRequestAware,
log.debug("Found encryped assertion. Start decryption ...");
- KeyStore keyStore = config.getPVP2KeyStore();
+ KeyStore keyStore = configuration.getPVP2KeyStore();
X509Credential authDecCredential = new KeyStoreX509CredentialAdapter(
keyStore,
- config.getPVP2KeystoreAuthRequestEncryptionKeyAlias(),
- config.getPVP2KeystoreAuthRequestEncryptionKeyPassword().toCharArray());
+ configuration.getPVP2KeystoreAuthRequestEncryptionKeyAlias(),
+ configuration.getPVP2KeystoreAuthRequestEncryptionKeyPassword().toCharArray());
StaticKeyInfoCredentialResolver skicr =
@@ -575,7 +572,14 @@ public class IndexAction extends ActionSupport implements ServletRequestAware,
public String requestNewUser() {
- HttpSession session = request.getSession();
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
+ }
+
if (session == null) {
log.warn("No active Session found");
return Constants.STRUTS_ERROR;
@@ -746,6 +750,14 @@ public class IndexAction extends ActionSupport implements ServletRequestAware,
public String mailAddressVerification() {
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
+ }
+
String userrequesttokken = request.getParameter(Constants.REQUEST_USERREQUESTTOKKEN);
if (MiscUtil.isNotEmpty(userrequesttokken)) {
@@ -805,11 +817,14 @@ public class IndexAction extends ActionSupport implements ServletRequestAware,
}
public String logout() {
-
- HttpSession session = request.getSession();
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
- authUser = (AuthenticatedUser) authUserObj;
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
+ }
if (session != null)
session.invalidate();
@@ -856,13 +871,6 @@ public class IndexAction extends ActionSupport implements ServletRequestAware,
return session;
}
-
- public void setServletResponse(HttpServletResponse arg0) {
-// this.response = arg0;
- }
- public void setServletRequest(HttpServletRequest arg0) {
- this.request = arg0;
- }
/**
* @return the password
@@ -893,13 +901,6 @@ public class IndexAction extends ActionSupport implements ServletRequestAware,
}
/**
- * @return the authUser
- */
- public AuthenticatedUser getAuthUser() {
- return authUser;
- }
-
- /**
* @return the user
*/
public UserDatabaseFrom getUser() {
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ListOAsAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ListOAsAction.java
index 4beb29343..e51ee7ca6 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ListOAsAction.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/ListOAsAction.java
@@ -42,26 +42,20 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase;
import at.gv.egovernment.moa.id.configuration.Constants;
import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
import at.gv.egovernment.moa.id.configuration.data.OAListElement;
+import at.gv.egovernment.moa.id.configuration.exception.BasicActionException;
import at.gv.egovernment.moa.id.configuration.exception.ConfigurationException;
import at.gv.egovernment.moa.id.configuration.helper.FormDataHelper;
import at.gv.egovernment.moa.id.configuration.helper.LanguageHelper;
import at.gv.egovernment.moa.id.configuration.validation.ValidationHelper;
import at.gv.egovernment.moa.util.MiscUtil;
-public class ListOAsAction extends ActionSupport implements ServletRequestAware,
- ServletResponseAware {
+public class ListOAsAction extends BasicAction {
private final Logger log = Logger.getLogger(ListOAsAction.class);
private static final long serialVersionUID = 1L;
-
- private HttpServletRequest request;
-
-// private HttpServletResponse response;
-// private ConfigurationProvider configuration;
-
- private List<OAListElement> formOAs;
- private AuthenticatedUser authUser;
+
+ private List<OAListElement> formOAs;
private String friendlyname;
public ListOAsAction() throws ConfigurationException {
@@ -70,16 +64,14 @@ public class ListOAsAction extends ActionSupport implements ServletRequestAware,
public String listAllOnlineAppliactions() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+
}
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
-
- authUser = (AuthenticatedUser) authUserObj;
-
List<OnlineApplication> dbOAs = null;
if (authUser.isAdmin()) {
@@ -109,9 +101,13 @@ public class ListOAsAction extends ActionSupport implements ServletRequestAware,
public String searchOAInit() {
- Object authUserObj = request.getSession().getAttribute(Constants.SESSION_AUTH);
-
- authUser = (AuthenticatedUser) authUserObj;
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
+ }
formOAs = null;
friendlyname = "";
@@ -121,16 +117,14 @@ public class ListOAsAction extends ActionSupport implements ServletRequestAware,
}
public String searchOA() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+
}
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
-
- authUser = (AuthenticatedUser) authUserObj;
-
if (MiscUtil.isEmpty(friendlyname)) {
log.info("SearchOA textfield is empty");
addActionError(LanguageHelper.getErrorString("validation.general.oafriendlyname.empty", request));
@@ -182,22 +176,6 @@ public class ListOAsAction extends ActionSupport implements ServletRequestAware,
return Constants.STRUTS_SUCCESS;
}
- public void setServletResponse(HttpServletResponse arg0) {
-// this.response = arg0;
- }
- public void setServletRequest(HttpServletRequest arg0) {
- this.request = arg0;
- }
-
-
- /**
- * @return the authUser
- */
- public AuthenticatedUser getAuthUser() {
- return authUser;
- }
-
-
/**
* @return the formOAs
*/
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/MainAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/MainAction.java
index bc5f3049f..ea6f17fc7 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/MainAction.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/MainAction.java
@@ -22,35 +22,16 @@
*******************************************************************************/
package at.gv.egovernment.moa.id.configuration.struts.action;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
import org.apache.log4j.Logger;
-import org.apache.struts2.interceptor.ServletRequestAware;
-import org.apache.struts2.interceptor.ServletResponseAware;
import at.gv.egovernment.moa.id.configuration.Constants;
-import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
-import at.gv.egovernment.moa.id.configuration.exception.ConfigurationException;
+import at.gv.egovernment.moa.id.configuration.exception.BasicActionException;
-public class MainAction implements ServletRequestAware,
- ServletResponseAware {
-
- private static final Logger log = Logger.getLogger(MainAction.class);
-
- private HttpServletRequest request;
-
-// private HttpServletResponse response;
-// private ConfigurationProvider configuration;
+public class MainAction extends BasicAction {
+ private static final long serialVersionUID = 221178766809263908L;
- private AuthenticatedUser authUser;
-
-
- public MainAction() throws ConfigurationException {
-// configuration = ConfigurationProvider.getInstance();
- }
+ private static final Logger log = Logger.getLogger(MainAction.class);
public String changeLanguage() {
@@ -59,36 +40,23 @@ public class MainAction implements ServletRequestAware,
public String generateMainFrame() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+
}
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
- authUser = (AuthenticatedUser) authUserObj;
+ if (hasActionMessages())
+ setActionMessages(getActionMessages());
+
+ if (hasActionErrors())
+ setActionErrors(getActionErrors());
session.setAttribute(Constants.SESSION_RETURNAREA, null);
return Constants.STRUTS_SUCCESS;
}
-
- public void setServletResponse(HttpServletResponse arg0) {
-// this.response = arg0;
- }
- public void setServletRequest(HttpServletRequest arg0) {
- this.request = arg0;
- }
-
-
- /**
- * @return the authUser
- */
- public AuthenticatedUser getAuthUser() {
- return authUser;
- }
-
-
-
}
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/OpenAdminRequestsAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/OpenAdminRequestsAction.java
index f064795ec..a4c768eda 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/OpenAdminRequestsAction.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/OpenAdminRequestsAction.java
@@ -38,37 +38,31 @@ import at.gv.egovernment.moa.id.commons.db.dao.config.UserDatabase;
import at.gv.egovernment.moa.id.configuration.Constants;
import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
import at.gv.egovernment.moa.id.configuration.data.OAListElement;
+import at.gv.egovernment.moa.id.configuration.exception.BasicActionException;
import at.gv.egovernment.moa.id.configuration.helper.FormDataHelper;
import com.opensymphony.xwork2.ActionSupport;
-public class OpenAdminRequestsAction extends ActionSupport
- implements ServletRequestAware, ServletResponseAware {
+public class OpenAdminRequestsAction extends BasicAction {
private static final Logger log = Logger.getLogger(OpenAdminRequestsAction.class);
private static final long serialVersionUID = 1L;
- private HttpServletRequest request;
-// private HttpServletResponse response;
-
- private AuthenticatedUser authUser = null;
private List<OAListElement> formOAs = null;
private List<AuthenticatedUser> userlist = null;
public String init() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+
}
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
-
- authUser = (AuthenticatedUser) authUserObj;
-
if (authUser.isAdmin()) {
List<OnlineApplication> dbOAs = ConfigurationDBRead.getAllNewOnlineApplications();
@@ -92,23 +86,6 @@ public class OpenAdminRequestsAction extends ActionSupport
}
-
- public void setServletResponse(HttpServletResponse response) {
-// this.response = response;
- }
-
- public void setServletRequest(HttpServletRequest request) {
- this.request = request;
- }
-
-
- /**
- * @return the authUser
- */
- public AuthenticatedUser getAuthUser() {
- return authUser;
- }
-
/**
* @return the formOAs
diff --git a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/UserManagementAction.java b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/UserManagementAction.java
index 0c475b1d5..382dc6372 100644
--- a/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/UserManagementAction.java
+++ b/id/ConfigWebTool/src/main/java/at/gv/egovernment/moa/id/configuration/struts/action/UserManagementAction.java
@@ -41,6 +41,7 @@ import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException;
import at.gv.egovernment.moa.id.configuration.Constants;
import at.gv.egovernment.moa.id.configuration.auth.AuthenticatedUser;
import at.gv.egovernment.moa.id.configuration.data.UserDatabaseFrom;
+import at.gv.egovernment.moa.id.configuration.exception.BasicActionException;
import at.gv.egovernment.moa.id.configuration.exception.ConfigurationException;
import at.gv.egovernment.moa.id.configuration.helper.AuthenticationHelper;
import at.gv.egovernment.moa.id.configuration.helper.FormDataHelper;
@@ -53,18 +54,12 @@ import at.gv.egovernment.moa.util.MiscUtil;
import com.opensymphony.xwork2.ActionSupport;
-public class UserManagementAction extends ActionSupport
- implements ServletRequestAware, ServletResponseAware {
+public class UserManagementAction extends BasicAction {
private static final Logger log = Logger.getLogger(UserManagementAction.class);
private static final long serialVersionUID = 1L;
- private HttpServletRequest request;
-// private HttpServletResponse response;
-
- private AuthenticatedUser authUser = null;
-
private List<AuthenticatedUser> userlist = null;
private UserDatabaseFrom user = null;
@@ -75,14 +70,18 @@ public class UserManagementAction extends ActionSupport
private String formID;
public String init() {
- HttpSession session = request.getSession();
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
+ return Constants.STRUTS_ERROR;
+
+ }
+
if (session == null) {
log.info("No http Session found.");
return Constants.STRUTS_ERROR;
}
-
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
- authUser = (AuthenticatedUser) authUserObj;
if (authUser.isAdmin()) {
@@ -122,15 +121,14 @@ public class UserManagementAction extends ActionSupport
}
public String createuser() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+
}
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
-
- authUser = (AuthenticatedUser) authUserObj;
nextPage = Constants.STRUTS_RETURNAREA_VALUES.usermanagementInit.name();
if (authUser.isAdmin()) {
@@ -149,15 +147,14 @@ public class UserManagementAction extends ActionSupport
}
public String edituser() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+
}
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
- authUser = (AuthenticatedUser) authUserObj;
-
Object nextPageAttr = session.getAttribute(Constants.SESSION_RETURNAREA);
if (nextPageAttr != null && nextPageAttr instanceof String
&& MiscUtil.isNotEmpty((String)nextPageAttr) ) {
@@ -202,14 +199,13 @@ public class UserManagementAction extends ActionSupport
}
public String saveuser() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+
}
-
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
- authUser = (AuthenticatedUser) authUserObj;
Object formidobj = session.getAttribute(Constants.SESSION_FORMID);
if (formidobj != null && formidobj instanceof String) {
@@ -349,15 +345,14 @@ public class UserManagementAction extends ActionSupport
}
public String deleteuser() {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+
}
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
- authUser = (AuthenticatedUser) authUserObj;
-
Object formidobj = session.getAttribute(Constants.SESSION_FORMID);
if (formidobj != null && formidobj instanceof String) {
String formid = (String) formidobj;
@@ -446,16 +441,15 @@ public class UserManagementAction extends ActionSupport
}
public String sendVerificationMail () {
- HttpSession session = request.getSession();
- if (session == null) {
- log.info("No http Session found.");
+ try {
+ populateBasicInformations();
+
+ } catch (BasicActionException e) {
return Constants.STRUTS_ERROR;
+
}
- String message = LanguageHelper.getErrorString("error.mail.verification", request);
-
- Object authUserObj = session.getAttribute(Constants.SESSION_AUTH);
- authUser = (AuthenticatedUser) authUserObj;
+ String message = new String();
if (authUser != null) {
UserDatabase dbuser = ConfigurationDBRead.getUserWithID(authUser.getUserID());
@@ -547,15 +541,6 @@ public class UserManagementAction extends ActionSupport
return null;
}
- public void setServletResponse(HttpServletResponse response) {
-// this.response = response;
-
- }
-
- public void setServletRequest(HttpServletRequest request) {
- this.request = request;
-
- }
/**
* @return the userlist
@@ -600,13 +585,6 @@ public class UserManagementAction extends ActionSupport
}
/**
- * @return the authUser
- */
- public AuthenticatedUser getAuthUser() {
- return authUser;
- }
-
- /**
* @return the newUser
*/
public boolean isNewUser() {
diff --git a/id/ConfigWebTool/src/main/resources/applicationResources_en.properties b/id/ConfigWebTool/src/main/resources/applicationResources_en.properties
index 5e116a974..4163cbc37 100644
--- a/id/ConfigWebTool/src/main/resources/applicationResources_en.properties
+++ b/id/ConfigWebTool/src/main/resources/applicationResources_en.properties
@@ -57,7 +57,7 @@ webpages.edit.export=Export
webpages.inportexport.import.header=MOA-ID 2.x configuration
webpages.inportexport.import.upload=Import configuration
webpages.inportexport.import.download=Export configuration
-webpages.inportexport.descripten=WARNING\: The imported configuration will completely replace currently active configuration!
+webpages.inportexport.descripten=WARNING\: The imported configuration will completely replace currently active configuration\!
webpages.usermanagement.newuser=Create new user
webpages.usermanagement.header=User management
@@ -291,8 +291,8 @@ webpages.oaconfig.vidp.ap.list=List of configured attribute providers
message.title=Announcement:
-webpages.oaconfig.success=The Online-Application {0} could not be saved.
-webpages.oaconfig.success.admin=Online-Applikation {0} could not be saved. The activation by the Administrator is necessary.
+webpages.oaconfig.success=The Online-Application {0} could be saved.
+webpages.oaconfig.success.admin=Online-Applikation {0} could be saved. The activation by the Administrator is necessary.
webpages.oaconfig.cancle=The processing of Online-Applikation {0} was interrupted.
webpages.oaconfig.delete.message=Online-Application {0} was succesfully removed.
diff --git a/id/ConfigWebTool/src/main/resources/struts.xml b/id/ConfigWebTool/src/main/resources/struts.xml
index 0a2039ced..4b006ffd9 100644
--- a/id/ConfigWebTool/src/main/resources/struts.xml
+++ b/id/ConfigWebTool/src/main/resources/struts.xml
@@ -8,6 +8,8 @@
<constant name="struts.custom.i18n.resources" value="webpages" />
<constant name="struts.mapper.action.prefix.enabled" value="true" />
<constant name="struts.mapper.action.prefix.crossNamespaces" value="false" />
+ <constant name="struts.xwork.chaining.copyErrors" value="true"/>
+ <constant name="struts.xwork.chaining.copyMessages" value="true"/>
<package name="default" namespace="/" extends="struts-default">
@@ -15,14 +17,12 @@
<interceptors>
<interceptor-stack name="OwnStack">
-<!-- <interceptor-ref name="params">
+ <interceptor-ref name="params">
<param
- name="excludeParams">^class\..*,^dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,^parameters\..*,^method:.*</param>
- </interceptor-ref>
- <interceptor-ref name="i18n">
- </interceptor-ref> -->
- <interceptor-ref name="defaultStack" />
- </interceptor-stack>
+ name="excludeParams">^class\..*,^dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,^parameters\..*,^method:.*</param>
+ </interceptor-ref>
+ <interceptor-ref name="defaultStack" />
+ </interceptor-stack>
</interceptors>
<default-interceptor-ref name="OwnStack"/>
@@ -34,12 +34,7 @@
</result>
<interceptor-ref name="OwnStack"/>
</action>
-
- <action name="changeLanguage" method="changeLanguage" class="at.gv.egovernment.moa.id.configuration.struts.action.IndexAction">
- <result name="success" type="chain">index</result>
- <interceptor-ref name="OwnStack"/>
- </action>
-
+
<action name="authenticate" method="authenticate" class="at.gv.egovernment.moa.id.configuration.struts.action.IndexAction">
<result name="success" type="redirectAction">
<param name="actionName">main</param>
@@ -91,14 +86,13 @@
<interceptors>
<interceptor-stack name="OwnStack">
- <interceptor-ref name="defaultStack" />
<interceptor-ref name="params">
<param
name="excludeParams">^class\..*,^dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,^parameters\..*,^method:.*</param>
- </interceptor-ref>
- <interceptor-ref name="i18n">
- </interceptor-ref>
- </interceptor-stack>
+ </interceptor-ref>
+ <interceptor-ref name="chain"/>
+ <interceptor-ref name="defaultStack" />
+ </interceptor-stack>
</interceptors>
<default-interceptor-ref name="OwnStack"/>
diff --git a/id/ConfigWebTool/src/main/webapp/WEB-INF/web.xml b/id/ConfigWebTool/src/main/webapp/WEB-INF/web.xml
index a1d95b897..3919d3ff3 100644
--- a/id/ConfigWebTool/src/main/webapp/WEB-INF/web.xml
+++ b/id/ConfigWebTool/src/main/webapp/WEB-INF/web.xml
@@ -24,7 +24,7 @@
</init-param>
<init-param>
<param-name>allowed</param-name>
- <param-value>^.*((/index.action.*)|(/error.action.*)|(/changeLanguage.action.*)|(/authenticate.action.*)|(/pvp2login.action.*)|(/mailAddressVerification.action.*)|(/logout.action)|(/jsp/.*)|(/css/.*)|(/servlet/.*)|(/images/.*)|(/js/.*))$</param-value>
+ <param-value>^.*((/index.action.*)|(/error.action.*)|(/authenticate.action.*)|(/pvp2login.action.*)|(/mailAddressVerification.action.*)|(/logout.action)|(/jsp/.*)|(/css/.*)|(/servlet/.*)|(/images/.*)|(/js/.*))$</param-value>
</init-param>
</filter>
<filter-mapping>
diff --git a/id/ConfigWebTool/src/main/webapp/css/index.css b/id/ConfigWebTool/src/main/webapp/css/index.css
index 597b4fd6c..eb984a896 100644
--- a/id/ConfigWebTool/src/main/webapp/css/index.css
+++ b/id/ConfigWebTool/src/main/webapp/css/index.css
@@ -15,7 +15,7 @@ body {
border-radius: 3px;
}
-#header_area>div {
+#header_area {
font-size: 1.2em;
margin-left: 25px;
padding-top: 8px;
@@ -23,7 +23,7 @@ body {
#header_area #logoutbutton {
float: right;
- padding-right: 25px;
+ /*padding-right: 25px;*/
}
#passwordlogin {
@@ -98,6 +98,9 @@ body {
#language_area {
float: right;
padding-bottom: 10px;
+ padding-left: 10px;
+ padding-right: 10px;
+ padding-top: 4px;
}
#message_area {
diff --git a/id/ConfigWebTool/src/main/webapp/index.jsp b/id/ConfigWebTool/src/main/webapp/index.jsp
index 2f793f303..fda077d28 100644
--- a/id/ConfigWebTool/src/main/webapp/index.jsp
+++ b/id/ConfigWebTool/src/main/webapp/index.jsp
@@ -17,8 +17,8 @@
<div id="information_area">
<div id="language_area">
- <a href="changeLanguage.action?request_locale=de" /><img alt="Deutsch" src="./images/de.png"></a>
- <a href="changeLanguage.action?request_locale=en" /><img alt="English" src="./images/en.png"></a>
+ <a href="index.action?request_locale=de" /><img alt="Deutsch" src="./images/de.png"></a>
+ <a href="index.action?request_locale=en" /><img alt="English" src="./images/en.png"></a>
</div>
<s:if test="hasActionMessages()">
diff --git a/id/ConfigWebTool/src/main/webapp/jsp/snippets/footer.jsp b/id/ConfigWebTool/src/main/webapp/jsp/snippets/footer.jsp
index 3f00984f2..e78319181 100644
--- a/id/ConfigWebTool/src/main/webapp/jsp/snippets/footer.jsp
+++ b/id/ConfigWebTool/src/main/webapp/jsp/snippets/footer.jsp
@@ -4,6 +4,6 @@
<html>
<div id="footer_area">
- MOA-ID 2.x Konfigurations-Tool
+ MOA-ID Konfigurations-Tool (Version: <s:property value="ConfigToolVersion"/>)
</div>
</html> \ No newline at end of file