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;
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;
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(Points.PATH, new Points(false), "Web of Trust");
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");
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.cacert.gigi.GigiApiException;
import org.cacert.gigi.localisation.Language;
-import org.cacert.gigi.pages.LoginPage;
import org.cacert.gigi.pages.Page;
import org.cacert.gigi.util.RandomToken;
}
}
+ /**
+ * Encapsulates a (non-failure) outcome of a form.
+ */
+ public static abstract class SubmissionResult {
+
+ public abstract boolean endsForm();
+ }
+
+ /**
+ * The form has finished and the user should see the successful completion
+ * on a regular page.
+ */
+ public static class RedirectResult extends SubmissionResult {
+
+ private final String target;
+
+ public RedirectResult(String target) {
+ this.target = target;
+ }
+
+ @Override
+ public boolean endsForm() {
+ return true;
+ }
+
+ }
+
+ /**
+ * The form has not finished and should be re-emitted, however no error
+ * occurred.
+ */
+ public static class FormContinue extends SubmissionResult {
+
+ @Override
+ public boolean endsForm() {
+ return false;
+ }
+ }
+
+ /**
+ * The form has successfully finished and a message should be emitted on a
+ * stateful page.
+ */
+ public static class SuccessMessageResult extends SubmissionResult {
+
+ private final Outputable message;
+
+ public SuccessMessageResult(Outputable message) {
+ this.message = message;
+ }
+
+ @Override
+ public boolean endsForm() {
+ return true;
+ }
+ }
+
public static final String CSRF_FIELD = "csrf";
- private static final String SUBMIT_EXCEPTION = "form-submit-exception";
+ public static final String SUBMIT_RESULT = "form-submit-result";
private final String csrf;
* @throws GigiApiException
* if form data had problems or operations went wrong.
*/
- public abstract boolean submit(HttpServletRequest req) throws GigiApiException;
+ public abstract SubmissionResult submit(HttpServletRequest req) throws GigiApiException;
- /**
- * Calls {@link #submit(PrintWriter, HttpServletRequest)} while catching and
- * displaying errors ({@link GigiApiException}), and re-outputing the form
- * via {@link #output(PrintWriter, Language, Map)}.
- *
- * @param out
- * the target to write the form and errors to
- * @param req
- * the request that this submit originated (for submit and for
- * language)
- * @return as {@link #submit(PrintWriter, HttpServletRequest)}: true, iff
- * the form succeeded and the user should be redirected.
- */
- public boolean submitProtected(PrintWriter out, HttpServletRequest req) {
+ public boolean submitExceptionProtected(HttpServletRequest req, HttpServletResponse resp) throws IOException {
try {
- boolean succeeded = submit(req);
- if (succeeded) {
- HttpSession hs = req.getSession();
- hs.removeAttribute("form/" + getClass().getName() + "/" + csrf);
+ SubmissionResult res = submit(req);
+ req.setAttribute(SUBMIT_RESULT, res);
+ if (res instanceof RedirectResult) {
+ resp.sendRedirect(((RedirectResult) res).target);
return true;
}
- } catch (GigiApiException e) {
- e.format(out, LoginPage.getLanguage(req));
- }
- output(out, LoginPage.getLanguage(req), new HashMap<String, Object>());
- return false;
- }
-
- public boolean submitExceptionProtected(HttpServletRequest req) {
- try {
- if (submit(req)) {
+ if (res.endsForm()) {
HttpSession hs = req.getSession();
hs.removeAttribute("form/" + getClass().getName() + "/" + csrf);
- return true;
}
return false;
} catch (PermamentFormException e) {
- req.setAttribute(SUBMIT_EXCEPTION, e);
+ req.setAttribute(SUBMIT_RESULT, e);
return false;
} catch (GigiApiException e) {
- req.setAttribute(SUBMIT_EXCEPTION, e);
+ req.setAttribute(SUBMIT_RESULT, e);
return false;
}
}
* @param out
* the output stream to the user to write the errors to.
* @return true if no permanent errors occurred and the form should be
- * reprinted.
+ * reprinted (and it has not already been successfully submitted)
*/
public static boolean printFormErrors(HttpServletRequest req, PrintWriter out) {
- Object o = req.getAttribute(SUBMIT_EXCEPTION);
+ Object o = req.getAttribute(SUBMIT_RESULT);
if (o != null && (o instanceof PermamentFormException)) {
((PermamentFormException) o).getCause().format(out, Page.getLanguage(req));
return false;
}
if (o != null && (o instanceof GigiApiException)) {
((GigiApiException) o).format(out, Page.getLanguage(req));
+ return true;
+ }
+ if (o != null && (o instanceof FormContinue)) {
+ return true;
+ }
+ if (o != null && (o instanceof SuccessMessageResult)) {
+ Outputable message = ((SuccessMessageResult) o).message;
+ if (message != null) {
+ out.println("<div class='alert alert-success'>");
+ message.output(out, Page.getLanguage(req), new HashMap<String, Object>());
+ out.println("</div>");
+ }
+ return false;
}
return true;
}
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public RedirectResult submit(HttpServletRequest req) throws GigiApiException {
if (RegisterPage.RATE_LIMIT.isLimitExceeded(req.getRemoteAddr())) {
throw new RateLimitException();
}
tryAuthWithUnpw(req);
- return false;
+ return new RedirectResult(redirectPath(req));
}
@Override
public static final String LOGIN_RETURNPATH = "login-returnpath";
- private static final String SUBMIT_EXCEPTION = "login-submit-exception";
-
public LoginPage() {
super("Password Login");
}
@Override
public boolean beforeTemplate(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- String redir = (String) req.getSession().getAttribute(LOGIN_RETURNPATH);
if (req.getSession().getAttribute("loggedin") == null) {
X509Certificate cert = getCertificateFromRequest(req);
if (cert != null) {
tryAuthWithCertificate(req, cert);
}
if (req.getMethod().equals("POST")) {
- if ( !Form.getForm(req, LoginForm.class).submitExceptionProtected(req)) {
- return false;
- }
+ return Form.getForm(req, LoginForm.class).submitExceptionProtected(req, resp);
}
}
if (req.getSession().getAttribute("loggedin") != null) {
- String s = redir;
- if (s != null) {
- if ( !s.startsWith("/")) {
- s = "/" + s;
- }
- resp.sendRedirect(s);
- } else {
- resp.sendRedirect("/");
- }
+ resp.sendRedirect(redirectPath(req));
return true;
}
return false;
}
+ private static String redirectPath(HttpServletRequest req) {
+ String redir = (String) req.getSession().getAttribute(LOGIN_RETURNPATH);
+ String s = redir;
+ if (s != null) {
+ if ( !s.startsWith("/")) {
+ s = "/" + s;
+ }
+ return s;
+ } else {
+ return "/";
+ }
+ }
+
@Override
public boolean needsLogin() {
return false;
--- /dev/null
+package org.cacert.gigi.pages;
+
+import java.io.IOException;
+import java.util.HashMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.cacert.gigi.output.template.Form;
+
+public abstract class ManagedFormPage extends Page {
+
+ Class<? extends Form> c;
+
+ public ManagedFormPage(String title, Class<? extends Form> t) {
+ super(title);
+ c = t;
+ }
+
+ @Override
+ public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ if (Form.printFormErrors(req, resp.getWriter())) {
+ Form form = Form.getForm(req, c);
+ form.output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
+ }
+ }
+
+ @Override
+ public boolean beforePost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ return Form.getForm(req, c).submitExceptionProtected(req, resp);
+ }
+
+}
--- /dev/null
+package org.cacert.gigi.pages;
+
+import java.io.IOException;
+import java.util.HashMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.cacert.gigi.output.template.Form;
+import org.cacert.gigi.output.template.Form.CSRFException;
+
+public abstract class ManagedMultiFormPage extends Page {
+
+ public ManagedMultiFormPage(String title) {
+ super(title);
+ }
+
+ @Override
+ public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ if (Form.printFormErrors(req, resp.getWriter())) {
+ getForm(req).output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
+ }
+ }
+
+ @Override
+ public boolean beforePost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ return getForm(req).submitExceptionProtected(req, resp);
+ }
+
+ public abstract Form getForm(HttpServletRequest req) throws CSRFException;
+
+}
import org.cacert.gigi.GigiApiException;
import org.cacert.gigi.output.template.Form;
-public abstract class OneFormPage extends Page {
+public class OneFormPage extends Page {
Class<? extends Form> c;
c = t;
}
+ @Override
+ public boolean beforePost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ return Form.getForm(req, c).submitExceptionProtected(req, resp);
+ }
+
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
Form form = Form.getForm(req, c);
- if (form.submitProtected(resp.getWriter(), req)) {
- resp.sendRedirect(getSuccessPath(form));
+ if (Form.printFormErrors(req, resp.getWriter())) {
+ form.output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
}
}
}
}
- public abstract String getSuccessPath(Form f);
-
}
import org.cacert.gigi.output.template.Form;
import org.cacert.gigi.output.template.MailTemplate;
import org.cacert.gigi.output.template.Template;
+import org.cacert.gigi.output.template.TranslateCommand;
import org.cacert.gigi.util.AuthorizationContext;
-import org.cacert.gigi.util.HTMLEncoder;
import org.cacert.gigi.util.RandomToken;
import org.cacert.gigi.util.ServerConstants;
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SuccessMessageResult submit(HttpServletRequest req) throws GigiApiException {
try (GigiPreparedStatement passwordReset = new GigiPreparedStatement("UPDATE `passwordResetTickets` SET `used` = CURRENT_TIMESTAMP WHERE `used` IS NULL AND `created` < CURRENT_TIMESTAMP - interval '1 hours' * ?;")) {
passwordReset.setInt(1, HOUR_MAX);
passwordReset.execute();
throw new GigiApiException("New passwords differ.");
}
u.consumePasswordResetTicket(id, tok, p1);
- return true;
+ return new SuccessMessageResult(new TranslateCommand("Password reset successful."));
}
@Override
protected void outputContent(PrintWriter out, Language l, Map<String, Object> vars) {
-
t.output(out, l, vars);
}
}
+ @Override
+ public boolean beforePost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ return Form.getForm(req, PasswordResetForm.class).submitExceptionProtected(req, resp);
+ }
+
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- PasswordResetForm form = Form.getForm(req, PasswordResetForm.class);
- PrintWriter w = resp.getWriter();
- if (form.submitProtected(w, req)) {
- w.println("<div class='alert alert-success'>");
- w.println(HTMLEncoder.encodeHTML(getLanguage(req).getTranslation("Password reset successful.")));
- w.println("</div>");
- return;
+ if (Form.printFormErrors(req, resp.getWriter())) {
+ PasswordResetForm form = Form.getForm(req, PasswordResetForm.class);
+ form.output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
}
}
import org.cacert.gigi.dbObjects.Verifyable;
import org.cacert.gigi.localisation.Language;
import org.cacert.gigi.output.template.Form;
+import org.cacert.gigi.output.template.Scope;
import org.cacert.gigi.output.template.SprintfCommand;
public class Verify extends Page {
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
+ HashMap<String, Object> data = new HashMap<>();
+ data.put("subject", subject);
if ("email".equals(type)) {
try {
target.verify(hash);
} catch (IllegalArgumentException e) {
throw new GigiApiException("The email address is invalid.");
}
+ return new SuccessMessageResult(new Scope(emailAddressVerified, data));
} else if ("domain".equals(type)) {
try {
target.verify(hash);
} catch (IllegalArgumentException e) {
throw new GigiApiException("The domain is invalid.");
}
+ return new SuccessMessageResult(new Scope(domainVerified, data));
+ } else {
+ throw new GigiApiException("Invalid object type.");
}
- return true;
}
@Override
return false;
}
+ @Override
+ public boolean beforePost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ return Form.getForm(req, VerificationForm.class).submitExceptionProtected(req, resp);
+ }
+
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- VerificationForm form = Form.getForm(req, VerificationForm.class);
- if (form.submitProtected(resp.getWriter(), req)) {
- String type = form.type;
- HashMap<String, Object> data = new HashMap<>();
- data.put("subject", form.subject);
- PrintWriter out = resp.getWriter();
- if ("email".equals(type)) {
- emailAddressVerified.output(out, getLanguage(req), data);
- } else if ("domain".equals(type)) {
- domainVerified.output(out, getLanguage(req), data);
- }
+ if (Form.printFormErrors(req, resp.getWriter())) {
+ Form.getForm(req, VerificationForm.class).output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
}
}
import org.cacert.gigi.localisation.Language;
import org.cacert.gigi.output.template.Form;
import org.cacert.gigi.output.template.Template;
+import org.cacert.gigi.output.template.TranslateCommand;
public class ChangeForm extends Form {
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
String oldpassword = req.getParameter("oldpassword");
String p1 = req.getParameter("pword1");
String p2 = req.getParameter("pword2");
if ( !error.isEmpty()) {
throw error;
}
- return true;
+ return new SuccessMessageResult(new TranslateCommand("Password changed."));
}
}
import javax.servlet.http.HttpServletResponse;
import org.cacert.gigi.dbObjects.User;
-import org.cacert.gigi.output.template.Form;
-import org.cacert.gigi.pages.Page;
+import org.cacert.gigi.pages.ManagedFormPage;
import org.cacert.gigi.util.AuthorizationContext;
-public class ChangePasswordPage extends Page {
+public class ChangePasswordPage extends ManagedFormPage {
public static final String PATH = "/account/password";
public ChangePasswordPage() {
- super("Change Password");
+ super("Change Password", ChangeForm.class);
}
@Override
new ChangeForm(req, getUser(req)).output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
}
- @Override
- public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- Form.getForm(req, ChangeForm.class).submitProtected(resp.getWriter(), req);
- }
-
@Override
public boolean isPermitted(AuthorizationContext ac) {
return ac != null && ac.getTarget() instanceof User;
private static final Template t = new Template(ChangePasswordPage.class.getResource("FindAgentAccess.templ"));
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
String nv = req.getParameter("new-val");
if (nv == null) {
- return false;
+ throw new GigiApiException("Parameter new-val missing.");
}
if (nv.equals("enable")) {
target.grantGroup(target, Group.LOCATE_AGENT);
} else {
target.revokeGroup(target, Group.LOCATE_AGENT);
}
- return true;
+ return new RedirectResult(FindAgentAccess.PATH);
}
@Override
@Override
public boolean beforePost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- if (req.getParameter("orgaForm") != null && Form.getForm(req, MyOrganisationsForm.class).submitExceptionProtected(req)) {
- resp.sendRedirect(PATH);
- return true;
+ if (req.getParameter("orgaForm") != null) {
+ return Form.getForm(req, MyOrganisationsForm.class).submitExceptionProtected(req, resp);
}
if (req.getParameter("action") != null || req.getParameter("removeName") != null || req.getParameter("deprecateName") != null || req.getParameter("preferred") != null) {
- if (Form.getForm(req, MyDetailsForm.class).submitExceptionProtected(req)) {
- resp.sendRedirect(PATH);
- return true;
- }
+ return Form.getForm(req, MyDetailsForm.class).submitExceptionProtected(req, resp);
}
return false;
}
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
try {
String rn = req.getParameter("removeName");
if (rn != null) {
throw new GigiApiException("Cannot remove the account's preferred name.");
}
n.remove();
- return true;
+ return new RedirectResult(MyDetails.PATH);
}
String dn = req.getParameter("deprecateName");
if (dn != null) {
throw new GigiApiException("Cannot deprecate the account's preferred name.");
}
n.deprecate();
- return true;
+ return new RedirectResult(MyDetails.PATH);
}
String pn = req.getParameter("preferred");
if (pn != null) {
Name n = Name.getById(Integer.parseInt(pn));
target.setPreferredName(n);
- return true;
+ return new RedirectResult(MyDetails.PATH);
}
String action = req.getParameter("action");
if ("addName".equals(action)) {
ni.update(req);
ni.createName(target);
- return true;
- }
- if ("updateDoB".equals(action)) {
+ return new RedirectResult(MyDetails.PATH);
+ } else if ("updateDoB".equals(action)) {
ds.update(req);
target.setDoB(ds.getDate());
- }
- if ("updateResidenceCountry".equals(action)) {
+ return new RedirectResult(MyDetails.PATH);
+ } else if ("updateResidenceCountry".equals(action)) {
cs.update(req);
target.setResidenceCountry(cs.getCountry());
- }
-
- if ("addGroup".equals(action) || "removeGroup".equals(action)) {
+ return new RedirectResult(MyDetails.PATH);
+ } else if ("addGroup".equals(action) || "removeGroup".equals(action)) {
selectedGroup.update(req);
Group toMod = selectedGroup.getGroup();
if ("addGroup".equals(action)) {
} else {
target.revokeGroup(target, toMod);
}
- return true;
+ return new RedirectResult(MyDetails.PATH);
+ } else {
+ throw new GigiApiException("Invalid action.");
}
} catch (NumberFormatException e) {
throw new GigiApiException("Invalid value.");
}
- return false;
}
@Override
private static final Template template = new Template(MyOrganisationsForm.class.getResource("MyOrganisationsForm.templ"));
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
if (req.getParameter("org-leave") != null) {
req.getSession().setAttribute(Gigi.AUTH_CONTEXT, new AuthorizationContext(target.getActor(), target.getActor()));
- return true;
+ return new RedirectResult(MyDetails.PATH);
}
Enumeration<String> i = req.getParameterNames();
int orgId = -1;
if (org.getId() == orgId) {
req.getSession().setAttribute(Gigi.AUTH_CONTEXT, new AuthorizationContext(org, target.getActor()));
- return true;
+ return new RedirectResult(MyDetails.PATH);
}
}
- System.out.println("Switch fialed");
- return false;
+ throw new PermamentFormException(new GigiApiException("Context switch failed."));
}
@Override
package org.cacert.gigi.pages.account.certs;
import java.io.IOException;
-import java.util.Collections;
import java.util.HashMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.cacert.gigi.dbObjects.Certificate;
-import org.cacert.gigi.dbObjects.Certificate.CertificateStatus;
import org.cacert.gigi.dbObjects.Group;
-import org.cacert.gigi.output.template.Form;
-import org.cacert.gigi.pages.Page;
+import org.cacert.gigi.pages.ManagedFormPage;
import org.cacert.gigi.util.AuthorizationContext;
-public class CertificateAdd extends Page {
+public class CertificateAdd extends ManagedFormPage {
public static final String PATH = "/account/certs/new";
public CertificateAdd() {
- super("Create certificate");
+ super("Create certificate", CertificateIssueForm.class);
}
@Override
new CertificateIssueForm(req).output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
}
- @Override
- public boolean beforePost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- CertificateIssueForm f = Form.getForm(req, CertificateIssueForm.class);
- if (f.submitExceptionProtected(req)) {
- Certificate c = f.getResult();
- if (c.getStatus() != CertificateStatus.ISSUED) {
- resp.getWriter().println("Timeout while waiting for certificate.");
- return false;
- }
- String ser = c.getSerial();
- if (ser.isEmpty()) {
- resp.getWriter().println("Timeout while waiting for certificate.");
- return false;
- }
- resp.sendRedirect(Certificates.PATH + "/" + ser);
- return true;
- }
- return super.beforePost(req, resp);
- }
-
- @Override
- public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- if (Form.printFormErrors(req, resp.getWriter())) {
- CertificateIssueForm f = Form.getForm(req, CertificateIssueForm.class);
- f.output(resp.getWriter(), getLanguage(req), Collections.<String, Object>emptyMap());
- }
- }
-
@Override
public boolean isPermitted(AuthorizationContext ac) {
return super.isPermitted(ac) && !ac.isInGroup(Group.BLOCKEDCERT);
import org.cacert.gigi.GigiApiException;
import org.cacert.gigi.dbObjects.Certificate;
+import org.cacert.gigi.dbObjects.Certificate.CertificateStatus;
import org.cacert.gigi.dbObjects.Certificate.SubjectAlternateName;
import org.cacert.gigi.dbObjects.CertificateProfile;
import org.cacert.gigi.dbObjects.Organisation;
CertificateValiditySelector issueDate = new CertificateValiditySelector();
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
String csr = req.getParameter("CSR");
String spkac = req.getParameter("SPKAC");
try {
if (csr != null) {
cr = new CertificateRequest(c, csr);
// TODO cr.checkKeyStrength(out);
- return false;
+ return new FormContinue();
} else if (spkac != null) {
cr = new CertificateRequest(c, spkac, spkacChallenge);
// TODO cr.checkKeyStrength(out);
- return false;
+ return new FormContinue();
} else if (cr != null) {
login = "1".equals(req.getParameter("login"));
issueDate.update(req);
}
result.issue(issueDate.getFrom(), issueDate.getTo(), c.getActor()).waitFor(60000);
this.result = result;
- return true;
+ Certificate c = result;
+ if (c.getStatus() != CertificateStatus.ISSUED) {
+ throw new PermamentFormException(new GigiApiException("Timeout while waiting for certificate."));
+ }
+ String ser = c.getSerial();
+ if (ser.isEmpty()) {
+ throw new PermamentFormException(new GigiApiException("Timeout while waiting for certificate."));
+ }
+ return new RedirectResult(Certificates.PATH + "/" + ser);
} else {
throw new GigiApiException("Error no action.");
}
import javax.servlet.http.HttpServletRequest;
+import org.cacert.gigi.GigiApiException;
import org.cacert.gigi.dbObjects.Certificate;
import org.cacert.gigi.dbObjects.CertificateOwner;
import org.cacert.gigi.dbObjects.Job;
private static final Template myTemplate = new Template(CertificateModificationForm.class.getResource("CertificateModificationForm.templ"));
@Override
- public boolean submit(HttpServletRequest req) {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
String action = req.getParameter("action");
if ( !"revoke".equals(action)) {
- return false;
+ throw new GigiApiException("Incorrect action given.");
}
String[] certs = req.getParameterValues("certs[]");
if (certs == null) {
- // nothing to do
- return false;
+ throw new GigiApiException("No certificates to revoke.");
}
LinkedList<Job> revokes = new LinkedList<Job>();
for (String serial : certs) {
break; // canceled... waited too log
}
}
-
- return false;
+ return new RedirectResult(req.getPathInfo());
}
@Override
@Override
public boolean beforePost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
if (support && "revoke".equals(req.getParameter("action"))) {
- if (Form.getForm(req, RevokeSingleCertForm.class).submitExceptionProtected(req)) {
- resp.sendRedirect(req.getPathInfo());
- return true;
- }
- return false;
+ return Form.getForm(req, RevokeSingleCertForm.class).submitExceptionProtected(req, resp);
}
if ( !req.getPathInfo().equals(PATH)) {
resp.sendError(500);
return true;
}
- if (Form.getForm(req, CertificateModificationForm.class).submitExceptionProtected(req)) {
- resp.sendRedirect(PATH);
- return true;
- }
- return false;
+ return Form.getForm(req, CertificateModificationForm.class).submitExceptionProtected(req, resp);
}
@Override
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public RedirectResult submit(HttpServletRequest req) throws GigiApiException {
if (target != null) {
target.revokeCertificate(c);
} else {
c.revoke().waitFor(60000);
}
- return true;
+ return new RedirectResult(req.getPathInfo());
}
@Override
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
try {
String parameter = req.getParameter("newdomain");
if (parameter.trim().isEmpty()) {
Domain d = new Domain(target, target, parameter);
pcf.setTarget(d);
pcf.submit(req);
- return true;
+ return new RedirectResult(DomainOverview.PATH);
} catch (NumberFormatException e) {
throw new GigiApiException("A number could not be parsed");
}
import org.cacert.gigi.output.template.Form;
import org.cacert.gigi.output.template.IterableDataset;
import org.cacert.gigi.output.template.Template;
+import org.cacert.gigi.pages.orga.ViewOrgPage;
public class DomainManagementForm extends Form {
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
String dels = req.getParameter("delete");
int delId = Integer.parseInt(dels);
} else {
throw new GigiApiException("Domain was not found.");
}
- return true;
- }
-
- public CertificateOwner getTarget() {
- return target;
+ if (foreign) {
+ return new RedirectResult(ViewOrgPage.DEFAULT_PATH + "/" + target.getId());
+ } else {
+ return new RedirectResult(DomainOverview.PATH);
+ }
}
@Override
Domain domain = doms[point];
vars.put("id", domain.getId());
if ( !foreign) {
- vars.put("domainhref", DomainOverview.PATH + domain.getId());
+ vars.put("domainhref", DomainOverview.PATH + "/" + domain.getId());
}
vars.put("domain", domain.getSuffix());
vars.put("status", l.getTranslation(domain.isVerified() ? "verified" : "not verified"));
import org.cacert.gigi.GigiApiException;
import org.cacert.gigi.dbObjects.CertificateOwner;
-import org.cacert.gigi.dbObjects.Domain;
import org.cacert.gigi.dbObjects.User;
import org.cacert.gigi.output.template.Form;
+import org.cacert.gigi.output.template.Form.CSRFException;
import org.cacert.gigi.pages.LoginPage;
-import org.cacert.gigi.pages.Page;
+import org.cacert.gigi.pages.ManagedMultiFormPage;
-public class DomainOverview extends Page {
+public class DomainOverview extends ManagedMultiFormPage {
- public static final String PATH = "/account/domains/";
+ public static final String PATH = "/account/domains";
public DomainOverview() {
super("Domains");
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
CertificateOwner u = LoginPage.getAuthorizationContext(req).getTarget();
- String pi = req.getPathInfo();
- if (pi.length() - PATH.length() > 0) {
- Form.printFormErrors(req, resp.getWriter());
- int i = Integer.parseInt(pi.substring(PATH.length()));
- Domain d;
- try {
- d = Domain.getById(i);
- } catch (IllegalArgumentException e) {
- resp.getWriter().println(getLanguage(req).getTranslation("Access denied"));
- return;
- }
- if (d == null || u.getId() != d.getOwner().getId()) {
- resp.getWriter().println(getLanguage(req).getTranslation("Access denied"));
- return;
- }
- new DomainPinglogForm(req, d).output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
- try {
- new PingConfigForm(req, d).output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
- } catch (GigiApiException e) {
- e.format(resp.getWriter(), getLanguage(req));
- }
- return;
-
- }
try {
DomainManagementForm domMan = new DomainManagementForm(req, u, false);
HashMap<String, Object> vars = new HashMap<>();
}
@Override
- public boolean beforePost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- String pi = req.getPathInfo();
- if (pi.length() - PATH.length() > 0) {
- if (req.getParameter("configId") != null) {
- if (Form.getForm(req, DomainPinglogForm.class).submitExceptionProtected(req)) {
- resp.sendRedirect(pi);
- return true;
- }
-
- } else {
- if (Form.getForm(req, PingConfigForm.class).submitExceptionProtected(req)) {
- resp.sendRedirect(pi);
- return true;
- }
- }
-
- }
- return super.beforePost(req, resp);
- }
-
- @Override
- public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ public Form getForm(HttpServletRequest req) throws CSRFException {
if (req.getParameter("adddomain") != null) {
- DomainAddForm f = Form.getForm(req, DomainAddForm.class);
- if (f.submitProtected(resp.getWriter(), req)) {
- resp.sendRedirect(PATH);
- }
+ return Form.getForm(req, DomainAddForm.class);
} else if (req.getParameter("delete") != null) {
- DomainManagementForm f = Form.getForm(req, DomainManagementForm.class);
- if (f.submitProtected(resp.getWriter(), req)) {
- resp.sendRedirect(PATH);
- }
+ return Form.getForm(req, DomainManagementForm.class);
}
- super.doPost(req, resp);
+ return null;
}
}
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
CertificateOwner u = LoginPage.getAuthorizationContext(req).getTarget();
- int i = Integer.parseInt(req.getPathInfo().substring(DomainOverview.PATH.length()));
+ int i = Integer.parseInt(req.getPathInfo().substring(DomainOverview.PATH.length() + 1));
Domain d = Domain.getById(i);
if (u.getId() != d.getOwner().getId()) {
throw new GigiApiException("Error, owner mismatch.");
throw new GigiApiException("Error, target mismatch.");
}
dpc.requestReping();
- return true;
+ return new RedirectResult(req.getPathInfo());
}
@Override
--- /dev/null
+package org.cacert.gigi.pages.account.domain;
+
+import java.io.IOException;
+import java.util.HashMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.cacert.gigi.GigiApiException;
+import org.cacert.gigi.dbObjects.CertificateOwner;
+import org.cacert.gigi.dbObjects.Domain;
+import org.cacert.gigi.output.template.Form;
+import org.cacert.gigi.output.template.Form.CSRFException;
+import org.cacert.gigi.pages.LoginPage;
+import org.cacert.gigi.pages.ManagedMultiFormPage;
+
+public class EditDomain extends ManagedMultiFormPage {
+
+ public static final String PATH = "/account/domains/";
+
+ public EditDomain() {
+ super("Domain");
+ }
+
+ @Override
+ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ CertificateOwner u = LoginPage.getAuthorizationContext(req).getTarget();
+ String pi = req.getPathInfo();
+ if (pi.length() - PATH.length() <= 0) {
+ return;
+ }
+ Form.printFormErrors(req, resp.getWriter());
+ int i = Integer.parseInt(pi.substring(PATH.length()));
+ Domain d;
+ try {
+ d = Domain.getById(i);
+ } catch (IllegalArgumentException e) {
+ resp.getWriter().println(getLanguage(req).getTranslation("Access denied"));
+ return;
+ }
+ if (d == null || u.getId() != d.getOwner().getId()) {
+ resp.getWriter().println(getLanguage(req).getTranslation("Access denied"));
+ return;
+ }
+ new DomainPinglogForm(req, d).output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
+ try {
+ new PingConfigForm(req, d).output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
+ } catch (GigiApiException e) {
+ e.format(resp.getWriter(), getLanguage(req));
+ }
+
+ }
+
+ @Override
+ public Form getForm(HttpServletRequest req) throws CSRFException {
+ String pi = req.getPathInfo();
+ if (pi.length() - PATH.length() <= 0) {
+ return null;
+ }
+ if (req.getParameter("configId") != null) {
+ return Form.getForm(req, DomainPinglogForm.class);
+ } else {
+ return Form.getForm(req, PingConfigForm.class);
+ }
+ }
+
+}
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
target.clearPings();
if (req.getParameter("emailType") != null && req.getParameter("email") != null) {
try {
}
}
Gigi.notifyPinger(null);
- return true;
+ return new RedirectResult(req.getPathInfo());
}
@Override
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
String formMail = req.getParameter("newemail");
mail = formMail;
try {
} catch (IllegalArgumentException e) {
throw new GigiApiException(new PlainOutputable("Invalid address."));
}
- return true;
+ return new RedirectResult(MailOverview.DEFAULT_PATH);
}
@Override
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
try {
String d;
if ((d = req.getParameter("default")) != null) {
} else if ((d = req.getParameter("reping")) != null) {
EmailAddress.getById(Integer.parseInt(d)).requestReping(Page.getLanguage(req));
}
- return true;
+ return new RedirectResult(MailOverview.DEFAULT_PATH);
} catch (IOException e1) {
throw new GigiApiException("Error while doing reping.");
}
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.cacert.gigi.GigiApiException;
import org.cacert.gigi.dbObjects.User;
import org.cacert.gigi.localisation.Language;
import org.cacert.gigi.output.template.Form;
+import org.cacert.gigi.output.template.Form.CSRFException;
+import org.cacert.gigi.pages.ManagedMultiFormPage;
import org.cacert.gigi.pages.Page;
import org.cacert.gigi.util.AuthorizationContext;
-public class MailOverview extends Page {
+public class MailOverview extends ManagedMultiFormPage {
public static final String DEFAULT_PATH = "/account/mails";
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- final User us = getUser(req);
+ User user = getUser(req);
+ output(req, resp, new MailAddForm(req, user), new MailManagementForm(req, user));
+ }
+
+ private void output(HttpServletRequest req, HttpServletResponse resp, MailAddForm addForm, MailManagementForm mgmtForm) throws IOException {
Language lang = Page.getLanguage(req);
HashMap<String, Object> vars = new HashMap<>();
- vars.put("addForm", new MailAddForm(req, us));
- vars.put("manForm", new MailManagementForm(req, us));
+ vars.put("addForm", addForm);
+ vars.put("manForm", mgmtForm);
getDefaultTemplate().output(resp.getWriter(), lang, vars);
}
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- try {
- if (req.getParameter("addmail") != null) {
- MailAddForm f = Form.getForm(req, MailAddForm.class);
- if (f.submit(req)) {
- resp.sendRedirect(MailOverview.DEFAULT_PATH);
- }
+ Form current = getForm(req);
+ if (Form.printFormErrors(req, resp.getWriter())) {
+ User user = getUser(req);
+ if (current instanceof MailAddForm) {
+ output(req, resp, (MailAddForm) current, new MailManagementForm(req, user));
} else {
- MailManagementForm f = Form.getForm(req, MailManagementForm.class);
- if (f.submit(req)) {
- resp.sendRedirect(MailOverview.DEFAULT_PATH);
- }
+ output(req, resp, new MailAddForm(req, user), (MailManagementForm) current);
}
- } catch (GigiApiException e) {
- e.format(resp.getWriter(), getLanguage(req));
}
- super.doPost(req, resp);
+ }
+
+ @Override
+ public Form getForm(HttpServletRequest req) throws CSRFException {
+ if (req.getParameter("addmail") != null) {
+ return Form.getForm(req, MailAddForm.class);
+ } else {
+ return Form.getForm(req, MailManagementForm.class);
+ }
}
@Override
public boolean isPermitted(AuthorizationContext ac) {
return ac != null && ac.getTarget() instanceof User;
}
+
}
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
if (req.getParameter("deny") != null) {
u.revokeGroup(ttpAdmin, TTPAdminPage.TTP_APPLICANT);
}
- return false;
+ return new RedirectResult(TTPAdminPage.PATH);
}
@Override
super("TTP-Admin");
}
+ @Override
+ public boolean beforePost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ return Form.getForm(req, TTPAdminForm.class).submitExceptionProtected(req, resp);
+ }
+
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- if (Form.getForm(req, TTPAdminForm.class).submitProtected(resp.getWriter(), req)) {
- resp.sendRedirect(PATH);
+ if (Form.printFormErrors(req, resp.getWriter())) {
+ Form.getForm(req, TTPAdminForm.class).output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
}
}
public class FindCertForm extends Form {
+ public static class FindResult extends SuccessMessageResult {
+
+ private final Certificate[] certs;
+
+ public FindResult(Certificate[] certs) {
+ super(null);
+ this.certs = certs;
+ }
+
+ public Certificate[] getCerts() {
+ return certs;
+ }
+ }
+
private static final Template t = new Template(FindCertForm.class.getResource("FindCertForm.templ"));
private final String SERIAL = "serial";
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
this.certType = req.getParameter("certType");
String request = req.getParameter("cert").trim();
throw new GigiApiException(SprintfCommand.createSimple("No certificate found matching {0}", request));
}
}
- return true;
+ return new FindCertForm.FindResult(getCerts());
}
@Override
new FindCertForm(req).output(resp.getWriter(), Page.getLanguage(req), new HashMap<String, Object>());
}
+ @Override
+ public boolean beforePost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ return Form.getForm(req, FindCertForm.class).submitExceptionProtected(req, resp);
+ }
+
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- FindCertForm form = Form.getForm(req, FindCertForm.class);
- if (form.submitProtected(resp.getWriter(), req)) {
- final Certificate[] certs = form.getCerts();
+ if ( !Form.printFormErrors(req, resp.getWriter())) {
+ final Certificate[] certs = ((FindCertForm.FindResult) req.getAttribute(Form.SUBMIT_RESULT)).getCerts();
if (certs.length == 1) {
resp.sendRedirect(Certificates.SUPPORT_PATH + "/" + certs[0].getSerial());
} else {
import org.cacert.gigi.GigiApiException;
import org.cacert.gigi.dbObjects.CertificateOwner;
import org.cacert.gigi.dbObjects.Domain;
+import org.cacert.gigi.dbObjects.Organisation;
+import org.cacert.gigi.dbObjects.User;
import org.cacert.gigi.localisation.Language;
import org.cacert.gigi.output.template.Form;
import org.cacert.gigi.output.template.SprintfCommand;
public class FindUserByDomainForm extends Form {
+ public static class FindDomainResult extends SuccessMessageResult {
+
+ private final CertificateOwner owner;
+
+ public FindDomainResult(CertificateOwner owner) {
+ super(null);
+ this.owner = owner;
+ }
+
+ public CertificateOwner getOwner() {
+ return owner;
+ }
+ }
+
private CertificateOwner res = null;
private static final Template t = new Template(FindUserByDomainForm.class.getResource("FindUserByDomainForm.templ"));
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
String request = req.getParameter("domain");
Domain d = null;
if (request.matches("#[0-9]+")) {
throw new GigiApiException(SprintfCommand.createSimple("No personal domains found matching {0}", request));
}
res = d.getOwner();
- return true;
+ if (res instanceof User) {
+ return new RedirectResult(SupportUserDetailsPage.PATH + res.getId() + "/");
+ } else if (res instanceof Organisation) {
+ return new RedirectResult("/support/domain/" + res.getId());
+ } else {
+ throw new PermamentFormException(new GigiApiException("Unknown owner type."));
+ }
}
@Override
package org.cacert.gigi.pages.admin.support;
-import org.cacert.gigi.dbObjects.CertificateOwner;
-import org.cacert.gigi.dbObjects.Organisation;
-import org.cacert.gigi.dbObjects.User;
-import org.cacert.gigi.output.template.Form;
-import org.cacert.gigi.pages.OneFormPage;
+import java.io.IOException;
+import java.util.HashMap;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.cacert.gigi.pages.ManagedFormPage;
+import org.cacert.gigi.pages.Page;
import org.cacert.gigi.util.AuthorizationContext;
-public class FindUserByDomainPage extends OneFormPage {
+public class FindUserByDomainPage extends ManagedFormPage {
public static final String PATH = "/support/find/domain";
}
@Override
- public String getSuccessPath(Form f) {
- CertificateOwner res = ((FindUserByDomainForm) f).getRes();
- if (res instanceof User) {
- return SupportUserDetailsPage.PATH + res.getId() + "/";
- } else if (res instanceof Organisation) {
- return "/support/domain/" + res.getId();
- } else {
- throw new Error("Unknown owner type.");
- }
+ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ new FindUserByDomainForm(req).output(resp.getWriter(), Page.getLanguage(req), new HashMap<String, Object>());
}
@Override
public class FindUserByEmailForm extends Form {
- private EmailAddress emails[];
+ public static class FindEmailResult extends SuccessMessageResult {
+
+ private final EmailAddress[] emails;
+
+ public FindEmailResult(EmailAddress[] emails) {
+ super(null);
+ this.emails = emails;
+ }
+
+ public EmailAddress[] getEmails() {
+ return emails;
+ }
+ }
private static final Template t = new Template(FindUserByDomainForm.class.getResource("FindUserByEmailForm.templ"));
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
EmailAddress[] emails = EmailAddress.findByAllEmail(req.getParameter("email"));
if (emails.length == 0) {
throw new GigiApiException(SprintfCommand.createSimple("No users found matching {0}", req.getParameter("email")));
}
- this.emails = emails;
- return true;
+ return new FindUserByEmailForm.FindEmailResult(emails);
}
@Override
protected void outputContent(PrintWriter out, Language l, Map<String, Object> vars) {
t.output(out, l, vars);
}
-
- public EmailAddress[] getEmails() {
- return emails;
- }
-
}
new FindUserByEmailForm(req).output(resp.getWriter(), Page.getLanguage(req), new HashMap<String, Object>());
}
+ @Override
+ public boolean beforePost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ return Form.getForm(req, FindUserByEmailForm.class).submitExceptionProtected(req, resp);
+ }
+
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- FindUserByEmailForm form = Form.getForm(req, FindUserByEmailForm.class);
- if (form.submitProtected(resp.getWriter(), req)) {
- final EmailAddress[] emails = form.getEmails();
+ if (Form.printFormErrors(req, resp.getWriter())) {
+ Form.getForm(req, FindUserByEmailForm.class).output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
+ } else {
+ final EmailAddress[] emails = ((FindUserByEmailForm.FindEmailResult) req.getAttribute(Form.SUBMIT_RESULT)).getEmails();
if (emails.length == 1) {
resp.sendRedirect(SupportUserDetailsPage.PATH + emails[0].getOwner().getId() + "/");
} else {
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
if (req.getParameter("setTicket") != null) {
// [asdmASDM]\d{8}\.\d+
String ticket = req.getParameter("ticketno");
if (ticket.matches("[asdmASDM]\\d{8}\\.\\d+")) {
AuthorizationContext ac = LoginPage.getAuthorizationContext(req);
req.getSession().setAttribute(Gigi.AUTH_CONTEXT, new AuthorizationContext(ac.getActor(), ticket));
- return true;
+ return new RedirectResult(SupportEnterTicketPage.PATH);
}
- return false;
+ throw new GigiApiException("Ticket format malformed");
} else if (req.getParameter("deleteTicket") != null) {
AuthorizationContext ac = LoginPage.getAuthorizationContext(req);
req.getSession().setAttribute(Gigi.AUTH_CONTEXT, new AuthorizationContext(ac.getActor(), ac.getActor()));
- return true;
+ return new RedirectResult(SupportEnterTicketPage.PATH);
}
- return false;
+ throw new GigiApiException("No valid action given.");
}
@Override
return false;
}
SupportEnterTicketForm f = Form.getForm(req, SupportEnterTicketForm.class);
- if (f.submitExceptionProtected(req)) {
- resp.sendRedirect(PATH);
- return true;
- }
- return false;
+ return f.submitExceptionProtected(req, resp);
}
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
if (user.getTicket() == null) {
throw new GigiApiException("No ticket number set.");
}
user.revokeAllCertificates();
- return true;
+ return new RedirectResult(req.getPathInfo());
}
@Override
import org.cacert.gigi.output.GroupSelector;
import org.cacert.gigi.output.template.Form;
import org.cacert.gigi.output.template.Template;
+import org.cacert.gigi.output.template.TranslateCommand;
import org.cacert.gigi.pages.LoginPage;
public class SupportUserDetailsForm extends Form {
private GroupSelector value = new GroupSelector("groupToModify", true);
- private boolean wasWithPasswordReset = false;
-
public SupportUserDetailsForm(HttpServletRequest hsr, SupportedUser user) {
super(hsr);
this.user = user;
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
if (user.getTicket() == null) {
throw new GigiApiException("No ticket number set.");
}
} else {
user.revoke(toMod);
}
- return true;
+ return new RedirectResult(req.getPathInfo());
}
if (req.getParameter("resetPass") != null) {
String aword = req.getParameter("aword");
throw new GigiApiException("An A-Word is required to perform a password reset.");
}
user.triggerPasswordReset(aword, req);
- wasWithPasswordReset = true;
- return true;
+ return new SuccessMessageResult(new TranslateCommand("Password reset successful."));
}
dobSelector.update(req);
if ( !dobSelector.isValid()) {
throw new GigiApiException("Invalid date of birth!");
}
user.setDob(dobSelector.getDate());
- return true;
- }
-
- public boolean wasWithPasswordReset() {
- return wasWithPasswordReset;
+ return new RedirectResult(req.getPathInfo());
}
@Override
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.cacert.gigi.GigiApiException;
import org.cacert.gigi.dbObjects.Domain;
import org.cacert.gigi.dbObjects.EmailAddress;
import org.cacert.gigi.dbObjects.SupportedUser;
import org.cacert.gigi.dbObjects.User;
import org.cacert.gigi.localisation.Language;
import org.cacert.gigi.output.template.Form;
+import org.cacert.gigi.output.template.Form.CSRFException;
import org.cacert.gigi.output.template.IterableDataset;
import org.cacert.gigi.pages.LoginPage;
-import org.cacert.gigi.pages.Page;
+import org.cacert.gigi.pages.ManagedMultiFormPage;
import org.cacert.gigi.util.AuthorizationContext;
-import org.cacert.gigi.util.HTMLEncoder;
-public class SupportUserDetailsPage extends Page {
+public class SupportUserDetailsPage extends ManagedMultiFormPage {
public static final String PATH = "/support/user/";
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ User user = getUser(req, resp);
+ if (user == null) {
+ return;
+ }
+ SupportedUser targetUser = new SupportedUser(user, getUser(req), LoginPage.getAuthorizationContext(req).getSupporterTicketId());
+ outputContents(req, resp, user, new SupportRevokeCertificatesForm(req, targetUser), new SupportUserDetailsForm(req, targetUser));
+ }
+
+ private User getUser(HttpServletRequest req, HttpServletResponse resp) throws IOException {
int id = -1;
if ( !req.getPathInfo().endsWith("/")) {
resp.sendError(404);
+ return null;
}
String[] idP = req.getPathInfo().split("/");
try {
id = Integer.parseInt(idP[idP.length - 1]);
} catch (NumberFormatException e) {
resp.sendError(404);
+ return null;
}
final User user = User.getById(id);
- SupportedUser targetUser = new SupportedUser(user, getUser(req), LoginPage.getAuthorizationContext(req).getSupporterTicketId());
- SupportUserDetailsForm f = new SupportUserDetailsForm(req, targetUser);
+ return user;
+ }
+
+ private void outputContents(HttpServletRequest req, HttpServletResponse resp, final User user, SupportRevokeCertificatesForm certificatesForm, SupportUserDetailsForm f) throws IOException {
HashMap<String, Object> vars = new HashMap<String, Object>();
vars.put("details", f);
final EmailAddress[] addrs = user.getEmails();
}
});
- vars.put("certifrevoke", new SupportRevokeCertificatesForm(req, targetUser));
+ vars.put("certifrevoke", certificatesForm);
getDefaultTemplate().output(resp.getWriter(), getLanguage(req), vars);
}
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- try {
- if (req.getParameter("revokeall") != null) {
- if ( !Form.getForm(req, SupportRevokeCertificatesForm.class).submitProtected(resp.getWriter(), req)) {
- throw new GigiApiException("No ticket number set.");
- }
- } else if (req.getParameter("detailupdate") != null || req.getParameter("resetPass") != null || req.getParameter("removeGroup") != null || req.getParameter("addGroup") != null) {
- SupportUserDetailsForm f = Form.getForm(req, SupportUserDetailsForm.class);
- if (f.wasWithPasswordReset()) {
- resp.getWriter().println(HTMLEncoder.encodeHTML(translate(req, "Password reset successful.")));
- }
- if ( !f.submitProtected(resp.getWriter(), req)) {
- throw new GigiApiException("No ticket number set.");
- }
+ User user = getUser(req, resp);
+ if (user == null) {
+ return;
+ }
+ if (Form.printFormErrors(req, resp.getWriter())) {
+ Form f = getForm(req);
+ SupportedUser targetUser = new SupportedUser(user, getUser(req), LoginPage.getAuthorizationContext(req).getSupporterTicketId());
+
+ if (f instanceof SupportUserDetailsForm) {
+ outputContents(req, resp, user, new SupportRevokeCertificatesForm(req, targetUser), (SupportUserDetailsForm) f);
+ } else if (f instanceof SupportRevokeCertificatesForm) {
+ outputContents(req, resp, user, (SupportRevokeCertificatesForm) f, new SupportUserDetailsForm(req, targetUser));
}
- } catch (GigiApiException e) {
- e.printStackTrace();
- e.format(resp.getWriter(), getLanguage(req));
}
- super.doPost(req, resp);
+
}
@Override
public boolean isPermitted(AuthorizationContext ac) {
return ac != null && ac.canSupport();
}
+
+ @Override
+ public Form getForm(HttpServletRequest req) throws CSRFException {
+ if (req.getParameter("revokeall") != null) {
+ return Form.getForm(req, SupportRevokeCertificatesForm.class);
+ } else if (req.getParameter("detailupdate") != null || req.getParameter("resetPass") != null || req.getParameter("removeGroup") != null || req.getParameter("addGroup") != null) {
+ return Form.getForm(req, SupportUserDetailsForm.class);
+ }
+ return null;
+ }
}
package org.cacert.gigi.pages.main;
import java.io.IOException;
-import java.io.PrintWriter;
import java.util.HashMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import org.cacert.gigi.GigiApiException;
import org.cacert.gigi.output.template.Form;
import org.cacert.gigi.pages.Page;
import org.cacert.gigi.util.AuthorizationContext;
public class RegisterPage extends Page {
- private static final String SIGNUP_PROCESS = "signupProcess";
-
public static final String PATH = "/register";
// 50 per 5 min
}
private void outputGet(HttpServletRequest req, HttpServletResponse resp, Signup s) throws IOException {
- PrintWriter out = resp.getWriter();
- HashMap<String, Object> vars = new HashMap<String, Object>();
- getDefaultTemplate().output(out, getLanguage(req), vars);
- s.output(out, getLanguage(req), vars);
+ getDefaultTemplate().output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
+ s.output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
+ }
+
+ @Override
+ public boolean beforePost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ return Form.getForm(req, Signup.class).submitExceptionProtected(req, resp);
}
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- Signup s = Form.getForm(req, Signup.class);
- try {
- if (s.submit(req)) {
- HttpSession hs = req.getSession();
- hs.setAttribute(SIGNUP_PROCESS, null);
- resp.getWriter().println(translate(req, "Your information has been submitted" + " into our system. You will now be sent an email with a web link," + " you need to open that link in your web browser within 24 hours" + " or your information will be removed from our system!"));
- return;
- }
- } catch (GigiApiException e) {
- e.format(resp.getWriter(), getLanguage(req));
+ if (Form.printFormErrors(req, resp.getWriter())) {
+ Signup s = Form.getForm(req, Signup.class);
+ outputGet(req, resp, s);
}
-
- outputGet(req, resp, s);
}
@Override
import org.cacert.gigi.output.template.PlainOutputable;
import org.cacert.gigi.output.template.SprintfCommand;
import org.cacert.gigi.output.template.Template;
+import org.cacert.gigi.output.template.TranslateCommand;
import org.cacert.gigi.pages.Page;
import org.cacert.gigi.util.CalendarUtil;
import org.cacert.gigi.util.HTMLEncoder;
}
@Override
- public synchronized boolean submit(HttpServletRequest req) throws GigiApiException {
+ public synchronized SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
if (RegisterPage.RATE_LIMIT.isLimitExceeded(req.getRemoteAddr())) {
throw new RateLimitException();
}
throw ga2;
}
run(req, pw1);
- return true;
+ return new SuccessMessageResult(new TranslateCommand("Your information has been submitted" + " into our system. You will now be sent an email with a web link," + " you need to open that link in your web browser within 24 hours" + " or your information will be removed from our system!"));
}
private void run(HttpServletRequest req, String password) throws GigiApiException {
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
if (req.getParameter("del") != null) {
User toRemove = User.getByEmail(req.getParameter("del"));
if (toRemove != null) {
o.removeAdmin(toRemove, LoginPage.getUser(req));
- return true;
+ return new RedirectResult(ViewOrgPage.DEFAULT_PATH + "/" + o.getId());
}
} else if (req.getParameter("do_affiliate") != null) {
User byEmail = User.getByEmail(req.getParameter("email"));
if (byEmail != null && byEmail.canAssure()) {
o.addAdmin(byEmail, LoginPage.getUser(req), req.getParameter("master") != null);
- return true;
+ return new RedirectResult(ViewOrgPage.DEFAULT_PATH + "/" + o.getId());
} else {
throw new GigiApiException("Requested user is not a RA Agent. We need a RA Agent here.");
}
});
t.output(out, l, vars);
}
-
- public Organisation getOrganisation() {
- return o;
- }
}
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
String action = req.getParameter("action");
if (action == null) {
- return false;
+ throw new GigiApiException("No action given.");
}
if (action.equals("new")) {
checkOrganisationData(req);
Organisation ne = new Organisation(o, cs.getCountry(), st, l, email, optionalName, postalAddress, LoginPage.getUser(req));
result = ne;
- return true;
} else if (action.equals("updateOrganisationData")) {
checkOrganisationData(req);
result.updateOrgData(email, optionalName, postalAddress);
- return true;
} else if (action.equals("updateCertificateData")) {
checkCertData(req);
result.updateCertData(o, cs.getCountry(), st, l);
- return true;
+ } else {
+ throw new GigiApiException("No valid action given.");
}
-
- return false;
+ return new RedirectResult(ViewOrgPage.DEFAULT_PATH + "/" + result.getId());
}
private void checkOrganisationData(HttpServletRequest req) throws GigiApiException {
return parameter.trim();
}
- public Organisation getResult() {
- return result;
- }
-
@Override
protected void outputContent(PrintWriter out, Language l, Map<String, Object> vars) {
vars.put("O", o);
import javax.servlet.http.HttpServletResponse;
import org.cacert.gigi.dbObjects.Group;
-import org.cacert.gigi.output.template.Form;
-import org.cacert.gigi.pages.Page;
+import org.cacert.gigi.pages.ManagedFormPage;
import org.cacert.gigi.util.AuthorizationContext;
-public class CreateOrgPage extends Page {
+public class CreateOrgPage extends ManagedFormPage {
public static final Group ORG_ASSURER = Group.ORGASSURER;
public static final String DEFAULT_PATH = "/orga/new";
public CreateOrgPage() {
- super("Create Organisation");
+ super("Create Organisation", CreateOrgForm.class);
}
@Override
return ac != null && ac.isInGroup(ORG_ASSURER);
}
- @Override
- public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- CreateOrgForm form = Form.getForm(req, CreateOrgForm.class);
- if (form.submitProtected(resp.getWriter(), req)) {
- resp.sendRedirect(ViewOrgPage.DEFAULT_PATH + "/" + form.getResult().getId());
- return;
- }
- }
-
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
new CreateOrgForm(req).output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
this.target = target;
}
- public Organisation getOrganisation() {
- return target;
- }
-
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
String domain = req.getParameter("domain");
new Domain(LoginPage.getUser(req), target, domain);
- return true;
+ return new RedirectResult(ViewOrgPage.DEFAULT_PATH + "/" + target.getId());
}
@Override
import org.cacert.gigi.dbObjects.User;
import org.cacert.gigi.localisation.Language;
import org.cacert.gigi.output.template.Form;
+import org.cacert.gigi.output.template.Form.CSRFException;
import org.cacert.gigi.output.template.IterableDataset;
import org.cacert.gigi.output.template.Template;
import org.cacert.gigi.pages.LoginPage;
-import org.cacert.gigi.pages.Page;
+import org.cacert.gigi.pages.ManagedMultiFormPage;
import org.cacert.gigi.pages.account.domain.DomainManagementForm;
import org.cacert.gigi.util.AuthorizationContext;
-public class ViewOrgPage extends Page {
+public class ViewOrgPage extends ManagedMultiFormPage {
private static final Template orgas = new Template(ViewOrgPage.class.getResource("ViewOrgs.templ"));
}
@Override
- public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- User u = LoginPage.getUser(req);
+ public Form getForm(HttpServletRequest req) throws CSRFException {
if (req.getParameter("do_affiliate") != null || req.getParameter("del") != null) {
- AffiliationForm form = Form.getForm(req, AffiliationForm.class);
- if (form.submitProtected(resp.getWriter(), req)) {
- resp.sendRedirect(DEFAULT_PATH + "/" + form.getOrganisation().getId());
- }
- return;
+ return Form.getForm(req, AffiliationForm.class);
} else {
- if ( !u.isInGroup(CreateOrgPage.ORG_ASSURER)) {
- resp.sendError(403, "Access denied");
- return;
+ if ( !getUser(req).isInGroup(CreateOrgPage.ORG_ASSURER)) {
+ return null;
}
if (req.getParameter("addDomain") != null) {
- OrgDomainAddForm form = Form.getForm(req, OrgDomainAddForm.class);
- if (form.submitProtected(resp.getWriter(), req)) {
- resp.sendRedirect(DEFAULT_PATH + "/" + form.getOrganisation().getId());
- }
+ return Form.getForm(req, OrgDomainAddForm.class);
} else if (req.getParameter("delete") != null) {
- DomainManagementForm form = Form.getForm(req, DomainManagementForm.class);
- if (form.submitProtected(resp.getWriter(), req)) {
- resp.sendRedirect(DEFAULT_PATH + "/" + form.getTarget().getId());
- }
+ return Form.getForm(req, DomainManagementForm.class);
} else {
- CreateOrgForm form = Form.getForm(req, CreateOrgForm.class);
- if (form.submitProtected(resp.getWriter(), req)) {
- resp.sendRedirect(DEFAULT_PATH + "/" + form.getResult().getId());
- }
+ return Form.getForm(req, CreateOrgForm.class);
}
}
-
}
@Override
import org.cacert.gigi.output.CountrySelector;
import org.cacert.gigi.output.template.Form;
import org.cacert.gigi.output.template.IterableDataset;
+import org.cacert.gigi.output.template.Outputable;
import org.cacert.gigi.output.template.SprintfCommand;
import org.cacert.gigi.output.template.Template;
+import org.cacert.gigi.output.template.TranslateCommand;
import org.cacert.gigi.pages.Page;
import org.cacert.gigi.pages.PasswordResetPage;
import org.cacert.gigi.util.DayDate;
public class AssuranceForm extends Form {
+ public static class ConcatOutputable implements Outputable {
+
+ private Outputable[] outputables;
+
+ public ConcatOutputable(Outputable... outputables) {
+ this.outputables = outputables;
+ }
+
+ @Override
+ public void output(PrintWriter out, Language l, Map<String, Object> vars) {
+ for (int i = 0; i < outputables.length; i++) {
+ if (i != 0) {
+ out.println();
+ }
+ outputables[i].output(out, l, vars);
+ }
+ }
+ }
+
private User assuree;
private Name[] assureeNames;
}
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
location = req.getParameter("location");
date = req.getParameter("date");
cs.update(req);
}
Notary.assureAll(assurer, assuree, dob, pointsI, location, req.getParameter("date"), type, toAssure.toArray(new Name[toAssure.size()]), cs.getCountry());
-
+ Outputable result = new TranslateCommand("Verification complete.");
if (isWithPasswordReset()) {
Language langApplicant = Language.getInstance(assuree.getPreferredLocale());
String method = langApplicant.getTranslation("A password reset was triggered. If you did a password reset by verification, please enter your secret password using this form:");
String subject = langApplicant.getTranslation("Password reset by verification");
PasswordResetPage.initPasswordResetProcess(assuree, req, aword, langApplicant, method, subject);
+ result = new ConcatOutputable(result, new TranslateCommand("Password reset successful."));
}
- return true;
+ return new SuccessMessageResult(result);
}
public boolean isWithPasswordReset() {
import org.cacert.gigi.output.template.Template;
import org.cacert.gigi.pages.Page;
import org.cacert.gigi.util.AuthorizationContext;
-import org.cacert.gigi.util.HTMLEncoder;
public class AssurePage extends Page {
return ac != null && ac.canAssure();
}
+ @Override
+ public boolean beforePost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ if (req.getParameter("search") == null) {
+ AssuranceForm form = Form.getForm(req, AssuranceForm.class);
+ return form.submitExceptionProtected(req, resp);
+ }
+ return super.beforePost(req, resp);
+ }
+
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
PrintWriter out = resp.getWriter();
if (req.getParameter("search") == null) {
- AssuranceForm form = Form.getForm(req, AssuranceForm.class);
- if (form.submitProtected(out, req)) {
- if (form.isWithPasswordReset()) {
- resp.getWriter().println(HTMLEncoder.encodeHTML(translate(req, "Password reset successful.")));
- }
- out.println(translate(req, "Verification complete."));
- return;
+ if (Form.printFormErrors(req, out)) {
+ AssuranceForm form = Form.getForm(req, AssuranceForm.class);
+ form.output(out, getLanguage(req), new HashMap<String, Object>());
}
return;
}
import org.cacert.gigi.output.template.Form;
import org.cacert.gigi.output.template.OutputableArrayIterable;
import org.cacert.gigi.output.template.Template;
+import org.cacert.gigi.output.template.TranslateCommand;
import org.cacert.gigi.pages.LoginPage;
public class RequestTTPForm extends Form {
};
@Override
- public boolean submit(HttpServletRequest req) throws GigiApiException {
+ public SubmissionResult submit(HttpServletRequest req) throws GigiApiException {
String country = req.getParameter("country");
if (country != null) {
int cid = Integer.parseInt(country);
User uReq = LoginPage.getUser(req);
if ( !u.equals(uReq)) {
- return false;
+ throw new GigiApiException("Internal logic error.");
}
u.grantGroup(u, TTP_APPLICANT);
-
- return false;
+ return new SuccessMessageResult(new TranslateCommand("Successfully applied for TTP."));
}
@Override
super("Request TTP");
}
+ @Override
+ public boolean beforePost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ return Form.getForm(req, RequestTTPForm.class).submitExceptionProtected(req, resp);
+ }
+
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- Form.getForm(req, RequestTTPForm.class).submitProtected(resp.getWriter(), req);
+ if (Form.printFormErrors(req, resp.getWriter())) {
+ Form.getForm(req, RequestTTPForm.class).output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
+ }
}
@Override
uc.addRequestProperty("Cookie", headerField);
uc.setDoOutput(true);
uc.getOutputStream().write((param + "&csrf=" + csrf).getBytes("UTF-8"));
+ if (uc.getResponseCode() == 302) {
+ return "";
+ }
String d = IOUtils.readURL(uc);
return d;
}
if (headerField == null) {
return "";
}
+ if (huc.getResponseCode() != 302) {
+ fail(fetchStartErrorMessage(IOUtils.readURL(huc)));
+ }
return stripCookie(headerField);
}
openConnection.getHeaderField("Location");
int code = ((HttpURLConnection) openConnection).getResponseCode();
if (code != 302) {
- throw new Error("Code was: " + code + "\ncontent was: " + IOUtils.readURL(openConnection));
+ throw new Error("Code was: " + code + "\ncontent was: " + fetchStartErrorMessage(IOUtils.readURL(openConnection)));
}
String newcontent = IOUtils.readURL(get(DomainOverview.PATH));
- Pattern dlink = Pattern.compile(DomainOverview.PATH + "([0-9]+)'>");
+ Pattern dlink = Pattern.compile(DomainOverview.PATH + "/([0-9]+)'>");
Matcher m1 = dlink.matcher(newcontent);
if ( !m1.find()) {
throw new Error(newcontent);
}
- return DomainOverview.PATH + m1.group(1);
+ return DomainOverview.PATH + "/" + m1.group(1);
}
protected Matcher initailizeDomainForm() throws IOException, Error {
org.cacert.gigi.pages.account.domain DomainOverview.DomainOverview(String),0
org.cacert.gigi.dbObjects Group.Group(String, String, boolean, boolean, boolean),1
org.cacert.gigi.output.template SprintfCommand.createSimple(String, Object[]),0
+org.cacert.gigi.pages ManagedFormPage.ManagedFormPage(String, Class),0
+org.cacert.gigi.pages ManagedMultiFormPage.ManagedMultiFormPage(String),0