X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2FGigi.java;h=c7a607940c0684709a511390fc36057593e82a23;hb=3238dff5b3beca228359b370bc104f48d6247632;hp=9e111ae78449c50b600e7d08294c41c5fa712716;hpb=7243641e3fc1ded767f1070a7300a099ad98ecad;p=gigi.git diff --git a/src/org/cacert/gigi/Gigi.java b/src/org/cacert/gigi/Gigi.java index 9e111ae7..c7a60794 100644 --- a/src/org/cacert/gigi/Gigi.java +++ b/src/org/cacert/gigi/Gigi.java @@ -32,7 +32,6 @@ import org.cacert.gigi.output.MenuCollector; import org.cacert.gigi.output.PageMenuItem; import org.cacert.gigi.output.SimpleMenuItem; import org.cacert.gigi.output.SimpleUntranslatedMenuItem; -import org.cacert.gigi.output.template.Form; import org.cacert.gigi.output.template.Form.CSRFException; import org.cacert.gigi.output.template.Outputable; import org.cacert.gigi.output.template.Template; @@ -56,8 +55,10 @@ import org.cacert.gigi.pages.account.UserTrainings; import org.cacert.gigi.pages.account.certs.CertificateAdd; import org.cacert.gigi.pages.account.certs.Certificates; import org.cacert.gigi.pages.account.domain.DomainOverview; +import org.cacert.gigi.pages.account.domain.EditDomain; import org.cacert.gigi.pages.account.mail.MailOverview; import org.cacert.gigi.pages.admin.TTPAdminPage; +import org.cacert.gigi.pages.admin.support.FindCertPage; import org.cacert.gigi.pages.admin.support.FindUserByDomainPage; import org.cacert.gigi.pages.admin.support.FindUserByEmailPage; import org.cacert.gigi.pages.admin.support.SupportEnterTicketPage; @@ -67,8 +68,9 @@ import org.cacert.gigi.pages.error.PageNotFound; import org.cacert.gigi.pages.main.RegisterPage; import org.cacert.gigi.pages.orga.CreateOrgPage; import org.cacert.gigi.pages.orga.ViewOrgPage; +import org.cacert.gigi.pages.statistics.StatisticsRoles; import org.cacert.gigi.pages.wot.AssurePage; -import org.cacert.gigi.pages.wot.MyPoints; +import org.cacert.gigi.pages.wot.Points; import org.cacert.gigi.pages.wot.RequestTTPPage; import org.cacert.gigi.ping.PingerDaemon; import org.cacert.gigi.util.AuthorizationContext; @@ -125,7 +127,7 @@ public final class Gigi extends HttpServlet { return ac == null; } }); - getMenu("SomeCA.org").addItem(new SimpleMenuItem("https://" + ServerConstants.getSecureHostNamePort() + "/login", "Certificate Login") { + getMenu("SomeCA.org").addItem(new SimpleMenuItem("https://" + ServerConstants.getSecureHostNamePortSecure() + "/login", "Certificate Login") { @Override public boolean isPermitted(AuthorizationContext ac) { @@ -134,18 +136,20 @@ public final class Gigi extends HttpServlet { }); putPage("/", new MainPage(), null); putPage("/roots", new RootCertPage(truststore), "SomeCA.org"); + putPage(StatisticsRoles.PATH, new StatisticsRoles(), "SomeCA.org"); putPage("/about", new AboutPage(), "SomeCA.org"); putPage("/secure", new TestSecure(), null); putPage(Verify.PATH, new Verify(), null); - putPage(Certificates.PATH + "/*", new Certificates(), "Certificates"); + putPage(Certificates.PATH + "/*", new Certificates(false), "Certificates"); putPage(RegisterPage.PATH, new RegisterPage(), "SomeCA.org"); putPage(CertificateAdd.PATH, new CertificateAdd(), "Certificates"); putPage(MailOverview.DEFAULT_PATH, new MailOverview(), "Certificates"); - putPage(DomainOverview.PATH + "*", new DomainOverview(), "Certificates"); + putPage(DomainOverview.PATH, new DomainOverview(), "Certificates"); + putPage(EditDomain.PATH + "*", new EditDomain(), null); putPage(AssurePage.PATH + "/*", new AssurePage(), "Web of Trust"); - putPage(MyPoints.PATH, new MyPoints(), "Web of Trust"); + putPage(Points.PATH, new Points(false), "Web of Trust"); putPage(RequestTTPPage.PATH, new RequestTTPPage(), "Web of Trust"); putPage(TTPAdminPage.PATH + "/*", new TTPAdminPage(), "Admin"); @@ -155,21 +159,18 @@ public final class Gigi extends HttpServlet { putPage(SupportEnterTicketPage.PATH, new SupportEnterTicketPage(), "Support Console"); putPage(FindUserByEmailPage.PATH, new FindUserByEmailPage(), "Support Console"); putPage(FindUserByDomainPage.PATH, new FindUserByDomainPage(), "Support Console"); + putPage(FindCertPage.PATH, new FindCertPage(), "Support Console"); putPage(SupportUserDetailsPage.PATH + "*", new SupportUserDetailsPage(), null); putPage(ChangePasswordPage.PATH, new ChangePasswordPage(), "My Account"); putPage(History.PATH, new History(false), "My Account"); - putPage(FindAgentAccess.PATH, new OneFormPage("Access to Find Agent", FindAgentAccess.class) { - - @Override - public String getSuccessPath(Form f) { - return FindAgentAccess.PATH; - } - }, "My Account"); + putPage(FindAgentAccess.PATH, new OneFormPage("Access to Find Agent", FindAgentAccess.class), "My Account"); putPage(History.SUPPORT_PATH, new History(true), null); putPage(UserTrainings.PATH, new UserTrainings(false), "My Account"); putPage(MyDetails.PATH, new MyDetails(), "My Account"); putPage(UserTrainings.SUPPORT_PATH, new UserTrainings(true), null); + putPage(Points.SUPPORT_PATH, new Points(true), null); + putPage(Certificates.SUPPORT_PATH + "/*", new Certificates(true), null); putPage(PasswordResetPage.PATH, new PasswordResetPage(), null); putPage(LogoutPage.PATH, new LogoutPage(), null); @@ -314,17 +315,9 @@ public final class Gigi extends HttpServlet { } - private static String staticTemplateVarHttp = "http://" + ServerConstants.getStaticHostNamePort(); - - private static String staticTemplateVarHttps = "https://" + ServerConstants.getStaticHostNamePortSecure(); + private static String staticTemplateVar = "//" + ServerConstants.getStaticHostNamePort(); - private static String getStaticTemplateVar(boolean https) { - if (https) { - return staticTemplateVarHttps; - } else { - return staticTemplateVarHttp; - } - } + private static String staticTemplateVarSecure = "//" + ServerConstants.getStaticHostNamePortSecure(); @Override protected void service(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { @@ -350,7 +343,7 @@ public final class Gigi extends HttpServlet { if (originHeader != null // && !(originHeader.matches("^" + Pattern.quote("https://" + ServerConstants.getWwwHostNamePortSecure()) + "(/.*|)") || // originHeader.matches("^" + Pattern.quote("http://" + ServerConstants.getWwwHostNamePort()) + "(/.*|)") || // - originHeader.matches("^" + Pattern.quote("https://" + ServerConstants.getSecureHostNamePort()) + "(/.*|)"))) { + originHeader.matches("^" + Pattern.quote("https://" + ServerConstants.getSecureHostNamePortSecure()) + "(/.*|)"))) { resp.setContentType("text/html; charset=utf-8"); resp.getWriter().println("AlertNo cross domain access allowed.
If you don't know why you're seeing this you may have been fished! Please change your password immediately!"); return; @@ -360,7 +353,7 @@ public final class Gigi extends HttpServlet { if (clientSerial != null) { X509Certificate[] cert = (X509Certificate[]) req.getAttribute("javax.servlet.request.X509Certificate"); if (cert == null || cert[0] == null// - || !cert[0].getSerialNumber().toString(16).toUpperCase().equals(clientSerial) // + || !cert[0].getSerialNumber().toString(16).toLowerCase().equals(clientSerial) // || !cert[0].getIssuerDN().equals(hs.getAttribute(CERT_ISSUER))) { hs.invalidate(); resp.sendError(403, "Certificate mismatch."); @@ -371,7 +364,7 @@ public final class Gigi extends HttpServlet { if (req.getParameter("lang") != null) { Locale l = Language.getLocaleFromString(req.getParameter("lang")); Language lu = Language.getInstance(l); - req.getSession().setAttribute(Language.SESSION_ATTRIB_NAME, lu.getLocale()); + req.getSession().setAttribute(Language.SESSION_ATTRIB_NAME, lu != null ? lu.getLocale() : Locale.ENGLISH); } final Page p = getPage(req.getPathInfo()); @@ -428,7 +421,7 @@ public final class Gigi extends HttpServlet { vars.put(Menu.AUTH_VALUE, currentAuthContext); vars.put("menu", rootMenu); vars.put("title", lang.getTranslation(p.getTitle())); - vars.put("static", getStaticTemplateVar(isSecure)); + vars.put("static", isSecure ? staticTemplateVarSecure : staticTemplateVar); vars.put("year", Calendar.getInstance().get(Calendar.YEAR)); vars.put("content", content); if (currentAuthContext != null) { @@ -446,7 +439,7 @@ public final class Gigi extends HttpServlet { } public static void addXSSHeaders(HttpServletResponse hsr, boolean doHttps) { - hsr.addHeader("Access-Control-Allow-Origin", "https://" + ServerConstants.getWwwHostNamePortSecure() + " https://" + ServerConstants.getSecureHostNamePort()); + hsr.addHeader("Access-Control-Allow-Origin", "https://" + ServerConstants.getWwwHostNamePortSecure() + " https://" + ServerConstants.getSecureHostNamePortSecure()); hsr.addHeader("Access-Control-Max-Age", "60"); if (doHttps) { hsr.addHeader("Content-Security-Policy", httpsCSP); @@ -469,7 +462,7 @@ public final class Gigi extends HttpServlet { csp.append(";media-src 'none'; object-src 'none'"); csp.append(";script-src https://" + ServerConstants.getStaticHostNamePortSecure()); csp.append(";style-src https://" + ServerConstants.getStaticHostNamePortSecure()); - csp.append(";form-action https://" + ServerConstants.getSecureHostNamePort() + " https://" + ServerConstants.getWwwHostNamePortSecure()); + csp.append(";form-action https://" + ServerConstants.getSecureHostNamePortSecure() + " https://" + ServerConstants.getWwwHostNamePortSecure()); // csp.append(";report-url https://api.cacert.org/security/csp/report"); return csp.toString(); } @@ -482,7 +475,7 @@ public final class Gigi extends HttpServlet { csp.append(";media-src 'none'; object-src 'none'"); csp.append(";script-src http://" + ServerConstants.getStaticHostNamePort()); csp.append(";style-src http://" + ServerConstants.getStaticHostNamePort()); - csp.append(";form-action https://" + ServerConstants.getSecureHostNamePort() + " https://" + ServerConstants.getWwwHostNamePort()); + csp.append(";form-action https://" + ServerConstants.getSecureHostNamePortSecure() + " https://" + ServerConstants.getWwwHostNamePort()); // csp.append(";report-url http://api.cacert.org/security/csp/report"); return csp.toString(); }