aboutsummaryrefslogtreecommitdiff
path: root/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java
diff options
context:
space:
mode:
Diffstat (limited to 'spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java')
-rw-r--r--spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java66
1 files changed, 64 insertions, 2 deletions
diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java
index 84b8561ac..25fa0d6ad 100644
--- a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java
+++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/config/ConfigurationProvider.java
@@ -38,6 +38,7 @@ import java.security.Principal;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -46,6 +47,7 @@ import org.w3c.dom.Element;
import at.gv.egovernment.moa.logging.LogMsg;
import at.gv.egovernment.moa.logging.Logger;
+import at.gv.egovernment.moa.spss.api.common.TSLConfiguration;
import at.gv.egovernment.moa.spss.util.MessageProvider;
import at.gv.egovernment.moa.util.DOMUtils;
@@ -142,8 +144,8 @@ public class ConfigurationProvider
* to distribution points (a <code>Set</code> of
* <code>DistributionPoint</code>s) mapping.
*/
- private Map distributionPoints;
+ private Map distributionPoints;
/**
* The CRL archive duration.
*/
@@ -250,6 +252,12 @@ public class ConfigurationProvider
private List blackListedUris_;
/**
+ * A <code>TSLConfiguration</code> that represents the global TSL configuration
+ */
+ private TSLConfiguration tslconfiguration_;
+
+
+ /**
* Return the single instance of configuration data.
*
* @return MOAConfigurationProvider The current configuration data.
@@ -356,6 +364,13 @@ public class ConfigurationProvider
cRLArchiveDuration = builder.getRevocationArchiveDuration();
revocationArchiveJDBCURL_ = builder.getRevocationArchiveJDBCURL();
revocationArchiveJDBCDriverClass_ = builder.getRevocationArchiveJDBCDriverClass();
+
+ tslconfiguration_ = builder.getTSLConfiguration();
+ //check TSL configuration
+ checkTSLConfiguration();
+
+
+
certStoreLocation_ = builder.getCertStoreLocation();
createTransformsInfoProfiles = builder.buildCreateTransformsInfoProfiles();
createSignatureEnvironmentProfiles = builder.buildCreateSignatureEnvironmentProfiles();
@@ -396,6 +411,31 @@ public class ConfigurationProvider
}
}
}
+
+ private void checkTSLConfiguration() throws ConfigurationException {
+ boolean bTSLEnabledTPExist = false;
+ Iterator it = trustProfiles.entrySet().iterator();
+ while (it.hasNext()) {
+ Map.Entry pairs = (Map.Entry)it.next();
+ TrustProfile tp = (TrustProfile) pairs.getValue();
+ if (tp.isTSLEnabled())
+ bTSLEnabledTPExist = bTSLEnabledTPExist || true;
+ }
+
+ if (!bTSLEnabledTPExist) {
+ // if no trustprofile has TSL support enabled, delete TSL configuration
+ tslconfiguration_ = null;
+ return;
+ }
+
+ if (bTSLEnabledTPExist && (tslconfiguration_ == null)) {
+ error("config.40", null);
+ throw new ConfigurationException("config.40", null);
+ }
+
+
+ }
+
/**
* Returns the warnings encountered during building the configuration.
@@ -691,6 +731,21 @@ public class ConfigurationProvider
}
/**
+ * Log an error.
+ *
+ * @param messageId The message ID.
+ * @param args Additional parameters for the message.
+ * @see at.gv.egovernment.moa.spss.server.util.MessageProvider
+ */
+ private void error(String messageId, Object[] args) {
+ MessageProvider msg = MessageProvider.getInstance();
+ String txt = msg.getMessage(messageId, args);
+
+ Logger.warn(new LogMsg(txt));
+// warnings.add(txt);
+ }
+
+ /**
* Returns the JDBC URL for the revocation archive database.
*
* @return the JDBC URL for the revocation archive database.
@@ -783,6 +838,13 @@ public class ConfigurationProvider
public Map getCrlRetentionIntervals() {
return crlRetentionIntervals;
}
-
+
+ /**
+ * Returns the global TSL configuration
+ * @return The global TSL configuration
+ */
+ public TSLConfiguration getTSLConfiguration() {
+ return tslconfiguration_;
+ }
} \ No newline at end of file