aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2015-06-19 12:14:20 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2015-06-19 12:14:20 +0200
commit1fb729e35f4c423cf2a1996cdcc6a213122f4e0e (patch)
tree4d0ad94176fe3d756a3297508a5e2ebf11cbc58c /id/server/idserverlib/src/main
parent95ce504efcf6eb886e353310570505d598e10561 (diff)
downloadmoa-id-spss-1fb729e35f4c423cf2a1996cdcc6a213122f4e0e.tar.gz
moa-id-spss-1fb729e35f4c423cf2a1996cdcc6a213122f4e0e.tar.bz2
moa-id-spss-1fb729e35f4c423cf2a1996cdcc6a213122f4e0e.zip
fix merge problems
Diffstat (limited to 'id/server/idserverlib/src/main')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigLoader.java10
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfiguration.java1
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java3
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/ConfigurationToJSONConverter.java310
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/PropertyBasedAuthConfigurationProvider.java87
5 files changed, 240 insertions, 171 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigLoader.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigLoader.java
index f5009f99f..80ecff2d2 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigLoader.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigLoader.java
@@ -47,11 +47,15 @@ public class AuthConfigLoader implements Runnable {
Date dbdate = moaidconfig.getTimestampItem();
Date pvprefresh = moaidconfig.getPvp2RefreshItem();
- Date date = AuthConfigurationProviderFactory.getInstance().getTimeStamp();
-
+ //TODO: check!!!!
+
+ //Date date = AuthConfigurationProviderFactory.getInstance().getTimeStamp();
+ Date date = new Date();
+
+
if (dbdate != null && dbdate.after(date)) {
AuthConfiguration instance = AuthConfigurationProviderFactory.getInstance();
- instance.reloadDataBaseConfig();
+// instance.reloadDataBaseConfig();
}
Date pvpdate = MOAMetadataProvider.getTimeStamp();
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfiguration.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfiguration.java
index cba80d536..7228e6129 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfiguration.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfiguration.java
@@ -1,6 +1,5 @@
package at.gv.egovernment.moa.id.config.auth;
-import java.util.Hashtable;
import java.util.List;
import java.util.Properties;
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java
index 81a3dad8f..dfb2a4dfd 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java
@@ -71,9 +71,7 @@ import at.gv.egovernment.moa.id.auth.modules.internal.tasks.GetMISSessionIDTask;
import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants;
import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead;
import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils;
-import at.gv.egovernment.moa.id.commons.db.NewConfigurationDBWrite;
import at.gv.egovernment.moa.id.commons.db.MOASessionDBUtils;
-import at.gv.egovernment.moa.id.commons.db.NewConfigurationDBRead;
import at.gv.egovernment.moa.id.commons.db.StatisticLogDBUtils;
import at.gv.egovernment.moa.id.commons.db.dao.config.AuthComponentGeneral;
import at.gv.egovernment.moa.id.commons.db.dao.config.ChainingModes;
@@ -123,6 +121,7 @@ import at.gv.egovernment.moa.util.MiscUtil;
import at.gv.util.config.EgovUtilPropertiesConfiguration;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
/**
* A class providing access to the Auth Part of the MOA-ID configuration data.
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/ConfigurationToJSONConverter.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/ConfigurationToJSONConverter.java
index cdd112a43..e1c1ac49e 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/ConfigurationToJSONConverter.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/ConfigurationToJSONConverter.java
@@ -1,155 +1,155 @@
-package at.gv.egovernment.moa.id.config.auth;
-
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-import at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration;
-import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead;
-import at.gv.egovernment.moa.id.config.ConfigurationException;
-import at.gv.egovernment.moa.id.config.ConfigurationProvider;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class ConfigurationToJSONConverter {
-
- @Autowired
- NewAuthConfigurationProvider configProvider;
-
- @Autowired
- MOAIDConfiguration configDataBase;
-
- public static void main(String[] args) {
-
- try {
- ConfigurationToJSONConverter converter = new ConfigurationToJSONConverter(args[0]);
- converter.writeConfigToJSONDB();
- System.out.println("=====================================");
- System.out.println("=====================================");
- converter.readConfigFromDB();
- System.out.println("=====================================");
- System.out.println("=====================================");
-
- // otherwise the database connection is not initialized
- JaxBAuthConfigurationProvider.getInstance();
- List<String> methodNames = Arrays.asList("getAllOnlineApplications", "getAllUsers", "getMOAIDConfiguration");
- converter.extractDataViaConfigurationDBRead(methodNames);
- converter.readExtractedConfigurationDBReadData(methodNames);
-
- } catch (ConfigurationException e) {
- e.printStackTrace();
- System.out.println("Problems reading the configuration file in: " + System.getProperty(ConfigurationProvider.CONFIG_PROPERTY_NAME));
- System.exit(1);
- }
-
- }
-
- public ConfigurationToJSONConverter(String pathToDBConfigPropertiesFile) throws ConfigurationException {
-
- System.getProperties().setProperty("location", "file:" + pathToDBConfigPropertiesFile);
- ApplicationContext context = new ClassPathXmlApplicationContext("configuration.beans.xml");
- AutowireCapableBeanFactory acbFactory = context.getAutowireCapableBeanFactory();
- acbFactory.autowireBean(this);
-
- }
-
- public void extractDataViaConfigurationDBRead(List<String> methodNames) {
- System.out.println("Start extracting");
- // read objects from db and write to key-value
- for (String name : methodNames) {
- try {
- Method method = ConfigurationDBRead.class.getMethod(name);
- Object tmp = method.invoke(null, new Object[] {});
- JsonProperty annotation = method.getAnnotation(JsonProperty.class);
- if (annotation != null) {
- configDataBase.set(annotation.value(), tmp);
- } else {
- System.out.println("Annotate Method with name: " + name);
- }
- } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
- | InvocationTargetException e) {
- System.out.println("Problems while extracting ConfigurationDBRead data.");
- }
- }
- }
-
- public void readExtractedConfigurationDBReadData(List<String> methodNames) {
- for (String name : methodNames) {
- Object tmp = configDataBase.get(name);
- System.out.println(">>> OBJECT: " + tmp);
- }
- }
-
- public void writeConfigToJSONDB() {
-
- try {
- // find all getter methods
- for (PropertyDescriptor pd : Introspector.getBeanInfo(NewAuthConfigurationProvider.class).getPropertyDescriptors()) {
- // check if correct methods, and not annotated with @JsonIgnore
- if ((pd.getReadMethod() != null)
- && (!"class".equals(pd.getName()))
- && (pd.getReadMethod().getAnnotation(JsonIgnore.class) == null)) {
-
- JsonProperty name = pd.getReadMethod().getAnnotation(JsonProperty.class);
- // get result of get method
- Object tmp;
- try {
- tmp = pd.getReadMethod().invoke(configProvider);
- // convert result to JSON
- if (name != null) {
- configDataBase.set(name.value(), tmp);
- } else {
- System.out.println("CHECK if '" + pd.getDisplayName() + "' is NOT ANNOTATED");
- }
- } catch (IllegalAccessException | InvocationTargetException e) {
- System.out.println("Problems while writing the configuration to the database.");
- }
- }
- }
-
- // no static method handling needed
-
- } catch (IllegalArgumentException e) {
- System.out.println("Problems while using reflection to get all getter methods.");
- } catch (IntrospectionException e) {
- System.out.println("Problems while using reflection to get all getter methods.");
- }
-
- }
-
- public void readConfigFromDB() {
- try {
- // find all getter methods
- for (PropertyDescriptor pd : Introspector.getBeanInfo(NewAuthConfigurationProvider.class)
- .getPropertyDescriptors()) {
- // check if correct methods, and not annotated with @JsonIgnore
- if ((pd.getReadMethod() != null)
- && (!"class".equals(pd.getName()))
- && (pd.getReadMethod().getAnnotation(JsonIgnore.class) == null)) {
- JsonProperty name = pd.getReadMethod().getAnnotation(JsonProperty.class);
- // get result of get method
- if (name != null) {
- System.out.println(">>> OBJECT: " + configDataBase.get(name.value()));
- } else {
- System.out.println("CHECK if '" + pd.getDisplayName() + "' is NOT ANNOTATED");
- }
- }
- }
- } catch (IllegalArgumentException e) {
- System.out.println("Problems while using reflection to get all getter methods.");
- } catch (IntrospectionException e) {
- System.out.println("Problems while using reflection to get all getter methods.");
- }
- }
-
-}
+//package at.gv.egovernment.moa.id.config.auth;
+//
+//import java.beans.IntrospectionException;
+//import java.beans.Introspector;
+//import java.beans.PropertyDescriptor;
+//import java.lang.reflect.InvocationTargetException;
+//import java.lang.reflect.Method;
+//import java.util.Arrays;
+//import java.util.List;
+//
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
+//import org.springframework.context.ApplicationContext;
+//import org.springframework.context.support.ClassPathXmlApplicationContext;
+//
+//import at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration;
+//import at.gv.egovernment.moa.id.commons.db.ConfigurationDBRead;
+//import at.gv.egovernment.moa.id.config.ConfigurationException;
+//import at.gv.egovernment.moa.id.config.ConfigurationProvider;
+//
+//import com.fasterxml.jackson.annotation.JsonIgnore;
+//import com.fasterxml.jackson.annotation.JsonProperty;
+//
+//public class ConfigurationToJSONConverter {
+//
+// @Autowired
+// NewAuthConfigurationProvider configProvider;
+//
+// @Autowired
+// MOAIDConfiguration configDataBase;
+//
+// public static void main(String[] args) {
+//
+// try {
+// ConfigurationToJSONConverter converter = new ConfigurationToJSONConverter(args[0]);
+// converter.writeConfigToJSONDB();
+// System.out.println("=====================================");
+// System.out.println("=====================================");
+// converter.readConfigFromDB();
+// System.out.println("=====================================");
+// System.out.println("=====================================");
+//
+// // otherwise the database connection is not initialized
+// JaxBAuthConfigurationProvider.getInstance();
+// List<String> methodNames = Arrays.asList("getAllOnlineApplications", "getAllUsers", "getMOAIDConfiguration");
+// converter.extractDataViaConfigurationDBRead(methodNames);
+// converter.readExtractedConfigurationDBReadData(methodNames);
+//
+// } catch (ConfigurationException e) {
+// e.printStackTrace();
+// System.out.println("Problems reading the configuration file in: " + System.getProperty(ConfigurationProvider.CONFIG_PROPERTY_NAME));
+// System.exit(1);
+// }
+//
+// }
+//
+// public ConfigurationToJSONConverter(String pathToDBConfigPropertiesFile) throws ConfigurationException {
+//
+// System.getProperties().setProperty("location", "file:" + pathToDBConfigPropertiesFile);
+// ApplicationContext context = new ClassPathXmlApplicationContext("configuration.beans.xml");
+// AutowireCapableBeanFactory acbFactory = context.getAutowireCapableBeanFactory();
+// acbFactory.autowireBean(this);
+//
+// }
+//
+// public void extractDataViaConfigurationDBRead(List<String> methodNames) {
+// System.out.println("Start extracting");
+// // read objects from db and write to key-value
+// for (String name : methodNames) {
+// try {
+// Method method = ConfigurationDBRead.class.getMethod(name);
+// Object tmp = method.invoke(null, new Object[] {});
+// JsonProperty annotation = method.getAnnotation(JsonProperty.class);
+// if (annotation != null) {
+// configDataBase.set(annotation.value(), tmp);
+// } else {
+// System.out.println("Annotate Method with name: " + name);
+// }
+// } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
+// | InvocationTargetException e) {
+// System.out.println("Problems while extracting ConfigurationDBRead data.");
+// }
+// }
+// }
+//
+// public void readExtractedConfigurationDBReadData(List<String> methodNames) {
+// for (String name : methodNames) {
+// Object tmp = configDataBase.get(name);
+// System.out.println(">>> OBJECT: " + tmp);
+// }
+// }
+//
+// public void writeConfigToJSONDB() {
+//
+// try {
+// // find all getter methods
+// for (PropertyDescriptor pd : Introspector.getBeanInfo(NewAuthConfigurationProvider.class).getPropertyDescriptors()) {
+// // check if correct methods, and not annotated with @JsonIgnore
+// if ((pd.getReadMethod() != null)
+// && (!"class".equals(pd.getName()))
+// && (pd.getReadMethod().getAnnotation(JsonIgnore.class) == null)) {
+//
+// JsonProperty name = pd.getReadMethod().getAnnotation(JsonProperty.class);
+// // get result of get method
+// Object tmp;
+// try {
+// tmp = pd.getReadMethod().invoke(configProvider);
+// // convert result to JSON
+// if (name != null) {
+// configDataBase.set(name.value(), tmp);
+// } else {
+// System.out.println("CHECK if '" + pd.getDisplayName() + "' is NOT ANNOTATED");
+// }
+// } catch (IllegalAccessException | InvocationTargetException e) {
+// System.out.println("Problems while writing the configuration to the database.");
+// }
+// }
+// }
+//
+// // no static method handling needed
+//
+// } catch (IllegalArgumentException e) {
+// System.out.println("Problems while using reflection to get all getter methods.");
+// } catch (IntrospectionException e) {
+// System.out.println("Problems while using reflection to get all getter methods.");
+// }
+//
+// }
+//
+// public void readConfigFromDB() {
+// try {
+// // find all getter methods
+// for (PropertyDescriptor pd : Introspector.getBeanInfo(NewAuthConfigurationProvider.class)
+// .getPropertyDescriptors()) {
+// // check if correct methods, and not annotated with @JsonIgnore
+// if ((pd.getReadMethod() != null)
+// && (!"class".equals(pd.getName()))
+// && (pd.getReadMethod().getAnnotation(JsonIgnore.class) == null)) {
+// JsonProperty name = pd.getReadMethod().getAnnotation(JsonProperty.class);
+// // get result of get method
+// if (name != null) {
+// System.out.println(">>> OBJECT: " + configDataBase.get(name.value()));
+// } else {
+// System.out.println("CHECK if '" + pd.getDisplayName() + "' is NOT ANNOTATED");
+// }
+// }
+// }
+// } catch (IllegalArgumentException e) {
+// System.out.println("Problems while using reflection to get all getter methods.");
+// } catch (IntrospectionException e) {
+// System.out.println("Problems while using reflection to get all getter methods.");
+// }
+// }
+//
+//}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/PropertyBasedAuthConfigurationProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/PropertyBasedAuthConfigurationProvider.java
index 38af90ade..94fbe46c4 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/PropertyBasedAuthConfigurationProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/PropertyBasedAuthConfigurationProvider.java
@@ -6,6 +6,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.math.BigInteger;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
@@ -14,6 +15,8 @@ import java.util.Properties;
import org.springframework.beans.factory.annotation.Autowired;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
import at.gv.egovernment.moa.id.auth.MOAIDAuthConstants;
import at.gv.egovernment.moa.id.commons.config.MOAIDConfigurationConstants;
import at.gv.egovernment.moa.id.commons.config.persistence.MOAIDConfiguration;
@@ -51,6 +54,7 @@ import at.gv.egovernment.moa.id.config.auth.data.ProtocolAllowed;
import at.gv.egovernment.moa.id.config.stork.STORKConfig;
import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.MiscUtil;
+import at.gv.util.config.EgovUtilPropertiesConfiguration;
/**
* A class providing access to the Auth Part of the MOA-ID configuration data.
@@ -63,7 +67,9 @@ public class PropertyBasedAuthConfigurationProvider extends ConfigurationProvide
private MOAIDConfiguration configuration;
private final Properties properties = new Properties();
-
+ private EgovUtilPropertiesConfiguration eGovUtilsConfig = null;
+
+
public PropertyBasedAuthConfigurationProvider() {
}
@@ -79,6 +85,23 @@ public class PropertyBasedAuthConfigurationProvider extends ConfigurationProvide
try (FileInputStream in = new FileInputStream(propertiesFile);) {
properties.load(in);
+
+ //read eGovUtils client configuration
+ Properties eGovUtilsConfigProp = new Properties();
+ for (Object key : properties.keySet()) {
+ String propPrefix = "service.";
+ if (key.toString().startsWith(propPrefix+"egovutil")) {
+ String propertyName = key.toString().substring(propPrefix.length());
+ eGovUtilsConfigProp.put(propertyName, properties.get(key.toString()));
+ }
+ }
+ if (!eGovUtilsConfigProp.isEmpty()) {
+ Logger.info("Start eGovUtils client implementation configuration ...");
+ eGovUtilsConfig =
+ new EgovUtilPropertiesConfiguration(eGovUtilsConfigProp, rootConfigFileDir);
+ }
+
+
} catch (FileNotFoundException e) {
throw new ConfigurationException("config.03", null, e);
} catch (IOException e) {
@@ -909,15 +932,6 @@ public class PropertyBasedAuthConfigurationProvider extends ConfigurationProvide
}
/**
- * Returns the current time.
- * @return the time stamp
- */
- public static Date getTimeStamp() {
-
- return new Date();
- }
-
- /**
* Returns a list of all {@link OnlineApplication}.
*
* @return list of all OnlineApplications
@@ -980,4 +994,57 @@ public class PropertyBasedAuthConfigurationProvider extends ConfigurationProvide
return result;
}
+ //Load document service url from moa properties
+ public String getDocumentServiceUrl() {
+ String prop = properties.getProperty("stork.documentservice.url", "false");
+ return prop;
+ }
+
+
+ public boolean isPVPSchemaValidationActive() {
+ String prop = properties.getProperty("protocols.pvp2.schemavalidation", "true");
+ return Boolean.valueOf(prop);
+ }
+
+ /**
+ * Checks if is fakeIdL is activated.
+ *
+ * @return true, if fake IdLs are available for stork
+ */
+ public boolean isStorkFakeIdLActive() {
+ String prop = properties.getProperty("stork.fakeIdL.active", "false");
+ return Boolean.valueOf(prop);
+ }
+
+ /**
+ * Gets the countries which will receive a fake IdL
+ *
+ * @return the countries
+ */
+ public List<String> getStorkFakeIdLCountries() {
+ String prop = properties.getProperty("stork.fakeIdL.countries", "");
+ return Arrays.asList(prop.replaceAll(" ", "").split(","));
+ }
+
+ /**
+ * Gets the resigning key (group) for the stork fake IdL.
+ *
+ * @return the resigning key
+ */
+ public String getStorkFakeIdLResigningKey() {
+ String prop = properties.getProperty("stork.fakeIdL.keygroup");
+ if (MiscUtil.isNotEmpty(prop))
+ return prop;
+ else
+ return null;
+ }
+
+ /**
+ * @return the eGovUtilsConfig
+ */
+ @JsonIgnore
+ public EgovUtilPropertiesConfiguration geteGovUtilsConfig() {
+ return eGovUtilsConfig;
+ }
+
}