import java.io.IOException;
import java.io.PrintWriter;
+import java.security.KeyStore;
import java.util.Calendar;
import java.util.HashMap;
import java.util.LinkedList;
import org.cacert.gigi.output.Menu;
import org.cacert.gigi.output.Outputable;
import org.cacert.gigi.output.PageMenuItem;
+import org.cacert.gigi.output.SimpleMenuItem;
import org.cacert.gigi.output.template.Template;
import org.cacert.gigi.pages.LoginPage;
import org.cacert.gigi.pages.LogoutPage;
import org.cacert.gigi.pages.MainPage;
import org.cacert.gigi.pages.Page;
+import org.cacert.gigi.pages.RootCertPage;
import org.cacert.gigi.pages.StaticPage;
import org.cacert.gigi.pages.TestSecure;
import org.cacert.gigi.pages.Verify;
private static Gigi instance;
- private PingerDaemon pinger = new PingerDaemon();
+ private PingerDaemon pinger;
- public Gigi(Properties conf) {
+ private KeyStore truststore;
+
+ public Gigi(Properties conf, KeyStore truststore) {
if (instance != null) {
throw new IllegalStateException("Multiple Gigi instances!");
}
instance = this;
DatabaseConnection.init(conf);
+ this.truststore = truststore;
+ pinger = new PingerDaemon(truststore);
pinger.start();
}
putPage("/error", new PageNotFound(), null);
putPage("/login", new LoginPage("CAcert - Login"), "Join CAcert.org");
putPage("/", new MainPage("CAcert - Home"), null);
+ putPage("/roots", new RootCertPage(truststore), "Join CAcert.org");
putPage(ChangePasswordPage.PATH, new ChangePasswordPage(), "My Account");
putPage(LogoutPage.PATH, new LogoutPage("Logout"), "My Account");
putPage("/secure", new TestSecure(), null);
menu.prepare();
rootMenu.addItem(menu);
}
+ Menu about = new Menu("About CAcert.org");
+ about.addItem(new SimpleMenuItem("//blog.cacert.org/", "CAcert News"));
+ about.addItem(new SimpleMenuItem("//wiki.cacert.org/", "Wiki Documentation"));
+ about.addItem(new SimpleMenuItem("/policy", "Policies"));
+ about.addItem(new SimpleMenuItem("//wiki.cacert.org/FAQ/Privileges", "Point System"));
+ about.addItem(new SimpleMenuItem("//bugs.cacert.org/", "Bug Database"));
+ about.addItem(new SimpleMenuItem("//wiki.cacert.org/Board", "CAcert Board"));
+ about.addItem(new SimpleMenuItem("//lists.cacert.org/wws", "Mailing Lists"));
+ about.addItem(new SimpleMenuItem("//blog.CAcert.org/feed", "RSS News Feed"));
+ about.prepare();
+ rootMenu.addItem(about);
+
rootMenu.prepare();
firstInstanceInited = true;
}
final Page p = getPage(req.getPathInfo());
if (p != null) {
- if (!isSecure && (p.needsLogin() || p instanceof LoginPage || p instanceof RegisterPage)) {
+ if ( !isSecure && (p.needsLogin() || p instanceof LoginPage || p instanceof RegisterPage)) {
resp.sendRedirect("https://" + ServerConstants.getWwwHostNamePortSecure() + req.getPathInfo());
return;
}
return instance.reveresePages.get(p).replaceFirst("/?\\*$", "");
}
+ public static void notifyPinger() {
+ instance.pinger.interrupt();
+ }
+
}