aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/config/auth/AuthConfigurationProvider.java53
1 files changed, 36 insertions, 17 deletions
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 5fc416b16..a4eab51d9 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
@@ -69,7 +69,10 @@ import at.gv.egovernment.moa.id.auth.AuthenticationServer;
import at.gv.egovernment.moa.id.auth.MOAIDAuthConstants;
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.MOAIDConfigurationConstants;
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;
@@ -337,7 +340,7 @@ public class AuthConfigurationProvider extends ConfigurationProvider implements
synchronized (AuthConfigurationProvider.class) {
//Initial config Database
- ConfigurationDBUtils.initHibernate(configProp);
+ // ConfigurationDBUtils.initHibernate(configProp);
//initial MOAID Session Database
Configuration config = new Configuration();
@@ -413,14 +416,24 @@ public class AuthConfigurationProvider extends ConfigurationProvider implements
//check if XML config should be used
if (MiscUtil.isNotEmpty(legacyconfig) || MiscUtil.isNotEmpty(xmlconfig)) {
Logger.warn("WARNING! MOA-ID 2.0 is started with XML configuration. This setup overstrike the actual configuration in the Database!");
- moaidconfig = ConfigurationDBRead.getMOAIDConfiguration();
- if (moaidconfig != null)
- ConfigurationDBUtils.delete(moaidconfig);
+ //moaidconfig = ConfigurationDBRead.getMOAIDConfiguration();
+ moaidconfig = NewConfigurationDBRead.getMOAIDConfiguration();
+ if (moaidconfig.getAuthComponentGeneral()!= null || moaidconfig.getChainingModes() != null || moaidconfig.getTrustedCACertificates() != null || moaidconfig.getDefaultBKUs() != null
+ || moaidconfig.getSLRequestTemplates() != null || moaidconfig.getTimestampItem() != null || moaidconfig.getPvp2RefreshItem() != null) {
+
+ // ConfigurationDBUtils.delete(moaidconfig);
+ for(String key : MOAIDConfigurationConstants.getMOAIDConfigurationKeys()){
+ NewConfigurationDBWrite.delete(key);
+ }
+ }
+
- List<OnlineApplication> oas = ConfigurationDBRead.getAllOnlineApplications();
+ //List<OnlineApplication> oas = ConfigurationDBRead.getAllOnlineApplications();
+ List<OnlineApplication> oas = NewConfigurationDBRead.getAllOnlineApplications();
if (oas != null && oas.size() > 0) {
- for (OnlineApplication oa : oas)
- ConfigurationDBUtils.delete(oa);
+ // for (OnlineApplication oa : oas)
+ // ConfigurationDBUtils.delete(oa);
+ NewConfigurationDBWrite.delete("getOnlineApplications");
}
}
@@ -431,17 +444,19 @@ public class AuthConfigurationProvider extends ConfigurationProvider implements
MOAIDConfiguration moaconfig = BuildFromLegacyConfig.build(new File(legacyconfig), rootConfigFileDir, null);
List<OnlineApplication> oas = moaconfig.getOnlineApplication();
- for (OnlineApplication oa : oas)
- ConfigurationDBUtils.save(oa);
+ // for (OnlineApplication oa : oas)
+ // ConfigurationDBUtils.save(oa);
+ NewConfigurationDBWrite.saveOnlineApplications(oas);
moaconfig.setOnlineApplication(null);
- ConfigurationDBUtils.save(moaconfig);
+ // ConfigurationDBUtils.save(moaconfig);
+ NewConfigurationDBWrite.save(moaconfig);
Logger.info("Legacy Configuration load is completed.");
}
-
+
//load MOA-ID 2.x config from XML
if (MiscUtil.isNotEmpty(xmlconfig)) {
Logger.warn("Load configuration from MOA-ID 2.x XML configuration");
@@ -454,12 +469,15 @@ public class AuthConfigurationProvider extends ConfigurationProvider implements
//ConfigurationDBUtils.save(moaconfig);
List<OnlineApplication> importoas = moaconfig.getOnlineApplication();
- for (OnlineApplication importoa : importoas) {
- ConfigurationDBUtils.saveOrUpdate(importoa);
- }
+ // for (OnlineApplication importoa : importoas) {
+ // ConfigurationDBUtils.saveOrUpdate(importoa);
+ // }
+
+ NewConfigurationDBWrite.saveOnlineApplications(importoas);
moaconfig.setOnlineApplication(null);
- ConfigurationDBUtils.saveOrUpdate(moaconfig);
+ //ConfigurationDBUtils.saveOrUpdate(moaconfig);
+ NewConfigurationDBWrite.save(moaconfig);
} catch (Exception e) {
Logger.warn("MOA-ID XML configuration can not be loaded from File.", e);
@@ -479,7 +497,8 @@ public class AuthConfigurationProvider extends ConfigurationProvider implements
public synchronized void reloadDataBaseConfig() throws ConfigurationException {
Logger.info("Read MOA-ID 2.0 configuration from database.");
- moaidconfig = ConfigurationDBRead.getMOAIDConfiguration();
+ //moaidconfig = ConfigurationDBRead.getMOAIDConfiguration();
+ moaidconfig = NewConfigurationDBRead.getMOAIDConfiguration();
Logger.info("MOA-ID 2.0 is loaded.");
if (moaidconfig == null) {
@@ -759,7 +778,7 @@ public class AuthConfigurationProvider extends ConfigurationProvider implements
}
//close Database
- ConfigurationDBUtils.closeSession();
+ // ConfigurationDBUtils.closeSession();
date = new Date();
}