aboutsummaryrefslogtreecommitdiff
path: root/id/ConfigWebTool/src/main/java/at/gv
diff options
context:
space:
mode:
Diffstat (limited to 'id/ConfigWebTool/src/main/java/at/gv')
-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
2 files changed, 49 insertions, 1 deletions
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;
}