summaryrefslogtreecommitdiffstats
path: root/base/java-tools/src/com/netscape/cmstools/tps/authenticator
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2013-12-16 04:13:11 -0500
committerEndi S. Dewata <edewata@redhat.com>2014-01-30 10:47:34 -0500
commitcd7a937200592038c2eff3253497e1eea68a1224 (patch)
treed141c93d2a3d495a2616c03e989aecb56d355bf4 /base/java-tools/src/com/netscape/cmstools/tps/authenticator
parent0caa396d65f15c37e9565760a30e0acd9ea7c617 (diff)
downloadpki-cd7a937200592038c2eff3253497e1eea68a1224.tar.gz
pki-cd7a937200592038c2eff3253497e1eea68a1224.tar.xz
pki-cd7a937200592038c2eff3253497e1eea68a1224.zip
Fixed TPS resource statuses.
TPS resources that are stored in CS.cfg have been refactored to update their statuses properly. These resources include profiles, profile mappings, connections, and authenticators. Ticket #654
Diffstat (limited to 'base/java-tools/src/com/netscape/cmstools/tps/authenticator')
-rw-r--r--base/java-tools/src/com/netscape/cmstools/tps/authenticator/AuthenticatorModifyCLI.java37
1 files changed, 25 insertions, 12 deletions
diff --git a/base/java-tools/src/com/netscape/cmstools/tps/authenticator/AuthenticatorModifyCLI.java b/base/java-tools/src/com/netscape/cmstools/tps/authenticator/AuthenticatorModifyCLI.java
index 292e03f75..0f82d1e55 100644
--- a/base/java-tools/src/com/netscape/cmstools/tps/authenticator/AuthenticatorModifyCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/tps/authenticator/AuthenticatorModifyCLI.java
@@ -48,8 +48,8 @@ public class AuthenticatorModifyCLI extends CLI {
public void execute(String[] args) throws Exception {
- Option option = new Option(null, "status", true, "Status: ENABLED, DISABLED.");
- option.setArgName("status");
+ Option option = new Option(null, "action", true, "Action: update (default), approve, reject, enable, disable.");
+ option.setArgName("action");
options.addOption(option);
option = new Option(null, "input", true, "Input file containing authenticator properties.");
@@ -75,24 +75,37 @@ public class AuthenticatorModifyCLI extends CLI {
}
String authenticatorID = cmdArgs[0];
- String status = cmd.getOptionValue("status");
+ String action = cmd.getOptionValue("action", "update");
String input = cmd.getOptionValue("input");
AuthenticatorData authenticatorData;
- try (BufferedReader in = new BufferedReader(new FileReader(input));
- StringWriter sw = new StringWriter();
- PrintWriter out = new PrintWriter(sw, true)) {
+ if (action.equals("update")) {
- String line;
- while ((line = in.readLine()) != null) {
- out.println(line);
+ if (input == null) {
+ System.err.println("Error: Missing input file");
+ printHelp();
+ System.exit(1);
+ return;
}
- authenticatorData = AuthenticatorData.valueOf(sw.toString());
- }
+ try (BufferedReader in = new BufferedReader(new FileReader(input));
+ StringWriter sw = new StringWriter();
+ PrintWriter out = new PrintWriter(sw, true)) {
+
+ String line;
+ while ((line = in.readLine()) != null) {
+ out.println(line);
+ }
+
+ authenticatorData = AuthenticatorData.valueOf(sw.toString());
+ }
+
+ authenticatorData = authenticatorCLI.authenticatorClient.updateAuthenticator(authenticatorID, authenticatorData);
- authenticatorData = authenticatorCLI.authenticatorClient.updateAuthenticator(authenticatorID, authenticatorData);
+ } else { // other actions
+ authenticatorData = authenticatorCLI.authenticatorClient.changeAuthenticatorStatus(authenticatorID, action);
+ }
MainCLI.printMessage("Modified authenticator \"" + authenticatorID + "\"");