From 987dda15acdd6e6f4c7c477fed122a76ad40260c Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Wed, 3 Feb 2016 23:54:56 +0100 Subject: Fixed token add operation. The TPS UI and CLI have been modified to accept only token ID, and optionally user ID and policy attributes when adding a token. https://fedorahosted.org/pki/ticket/1477 https://fedorahosted.org/pki/ticket/1687 --- .../src/com/netscape/cmstools/tps/token/TokenAddCLI.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'base/java-tools/src/com') diff --git a/base/java-tools/src/com/netscape/cmstools/tps/token/TokenAddCLI.java b/base/java-tools/src/com/netscape/cmstools/tps/token/TokenAddCLI.java index a63df2e80..1615846d6 100644 --- a/base/java-tools/src/com/netscape/cmstools/tps/token/TokenAddCLI.java +++ b/base/java-tools/src/com/netscape/cmstools/tps/token/TokenAddCLI.java @@ -42,13 +42,16 @@ public class TokenAddCLI extends CLI { } public void printHelp() { - formatter.printHelp(getFullName() + " --user [OPTIONS...]", options); + formatter.printHelp(getFullName() + " [OPTIONS...]", options); } public void createOptions() { Option option = new Option(null, "user", true, "User ID"); option.setArgName("User ID"); - option.setRequired(true); + options.addOption(option); + + option = new Option(null, "policy", true, "Policy"); + option.setArgName("Policy"); options.addOption(option); } @@ -83,7 +86,12 @@ public class TokenAddCLI extends CLI { TokenData tokenData = new TokenData(); tokenData.setTokenID(tokenID); - tokenData.setUserID(cmd.getOptionValue("user")); + + String userID = cmd.getOptionValue("user"); + tokenData.setUserID(userID); + + String policy = cmd.getOptionValue("policy"); + tokenData.setPolicy(policy); tokenData = tokenCLI.tokenClient.addToken(tokenData); -- cgit