]> WPIA git - gigi.git/blobdiff - src/club/wpia/gigi/util/ServerConstants.java
add: implement OCSP serving
[gigi.git] / src / club / wpia / gigi / util / ServerConstants.java
index d95db1b538f2b54a2a72f91df7d0507f98ef3959..4e2d9c928fd82d9f173a486b93773dac5b720e7e 100644 (file)
@@ -5,6 +5,8 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
+import club.wpia.gigi.ocsp.OCSPResponder;
+
 public class ServerConstants {
 
     public enum Host {
@@ -35,7 +37,11 @@ public class ServerConstants {
          * Hosts the certificate repository for the certificates generated
          * during NRE. Also not served by Gigi.
          */
-        CRT_REPO("g2.crt");
+        CRT_REPO("g2.crt"),
+        /**
+         * Hosts the {@link OCSPResponder}.
+         */
+        OCSP_RESPONDER("g2.ocsp");
 
         private final String value;
 
@@ -60,6 +66,8 @@ public class ServerConstants {
 
     private static String appName = null;
 
+    private static String appIdentifier = null;
+
     public static void init(Properties conf) {
         securePort = port = "";
         if ( !conf.getProperty("https.port").equals("443")) {
@@ -71,7 +79,7 @@ public class ServerConstants {
         secureBindPort = conf.getProperty("https.bindPort", conf.getProperty("https.port"));
         bindPort = conf.getProperty("http.bindPort", conf.getProperty("http.port"));
 
-        suffix = conf.getProperty("name.suffix", conf.getProperty("name.www", "www.wpia.local").substring(4));
+        suffix = conf.getProperty("name.suffix", "wpia.local");
         HashMap<Host, String> hostnames = new HashMap<>();
         for (Host h : Host.values()) {
             hostnames.put(h, conf.getProperty("name." + h.getConfigName(), h.getHostDefaultPrefix() + "." + suffix));
@@ -81,6 +89,10 @@ public class ServerConstants {
         if (appName == null) {
             throw new Error("App name missing");
         }
+        appIdentifier = conf.getProperty("appIdentifier");
+        if (appIdentifier == null) {
+            throw new Error("App identifier missing");
+        }
     }
 
     public static String getHostName(Host h) {
@@ -150,4 +162,11 @@ public class ServerConstants {
         return appName;
     }
 
+    public static String getAppIdentifier() {
+        if (appIdentifier == null) {
+            throw new Error("AppIdentifier not initialized.");
+        }
+        return appIdentifier;
+    }
+
 }