aboutsummaryrefslogtreecommitdiff
path: root/src/main/ui/IssueScreen.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/ui/IssueScreen.java')
-rw-r--r--src/main/ui/IssueScreen.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main/ui/IssueScreen.java b/src/main/ui/IssueScreen.java
index 93e1948..8376146 100644
--- a/src/main/ui/IssueScreen.java
+++ b/src/main/ui/IssueScreen.java
@@ -5,6 +5,9 @@ import model.ca.Template;
import model.csr.CertificationRequest;
import model.pki.cert.Certificate;
+/**
+ * The screen that accepts a CSR and template and allows user to change its properties and issue.
+ */
public class IssueScreen implements UIHandler {
private final JCA session;
@@ -29,6 +32,9 @@ public class IssueScreen implements UIHandler {
this.template = (Template) args[1];
}
+ /**
+ * EFFECTS: Print help.
+ */
@Override
public void help() {
System.out.print("show\tView the current certificate\n"
@@ -38,6 +44,9 @@ public class IssueScreen implements UIHandler {
+ "help\tPrint this message\n");
}
+ /**
+ * EFFECTS: Print pending cert info.
+ */
@Override
public void show() {
System.out.println("Requested Subject:\t" + incomingCSR.getCertificationRequestInfo().getSubject());
@@ -48,6 +57,10 @@ public class IssueScreen implements UIHandler {
System.out.println("Validity:\t" + template.getValidity() + " days");
}
+ /**
+ * EFFECTS: Issue the cert and log it.
+ * MODIFIES: session
+ */
@Override
public void commit() {
try {
@@ -60,6 +73,10 @@ public class IssueScreen implements UIHandler {
}
}
+ /**
+ * EFFECTS: Set or unset the subject.
+ * MODIFIES: template
+ */
private void handleIssueSetSubject(String val) {
try {
template.setSubject(val);
@@ -68,6 +85,10 @@ public class IssueScreen implements UIHandler {
}
}
+ /**
+ * EFFECTS: Set or unset the validity.
+ * MODIFIES: template
+ */
private void handleIssueSetValidity(String val) {
if (val == null) {
System.out.println("Cannot unset validity");
@@ -85,6 +106,10 @@ public class IssueScreen implements UIHandler {
}
}
+ /**
+ * EFFECTS: Handle the set command.
+ * MODIFIES: template
+ */
private void handleIssueSet(String... args) {
if (args.length != 2 && args.length != 3) {
System.out.println("Usage: set <key> <value>");
@@ -128,6 +153,9 @@ public class IssueScreen implements UIHandler {
return Screen.MAIN;
}
+ /**
+ * EFFECTS: Return "/subj/ %"
+ */
@Override
public String getPS1() {
return String.format("/%s/ %%", template.getSubject() == null