ivankelly commented on a change in pull request #2888: PIP-25: Token based 
authentication
URL: https://github.com/apache/pulsar/pull/2888#discussion_r236590927
 
 

 ##########
 File path: 
pulsar-broker/src/main/java/org/apache/pulsar/utils/auth/tokens/TokensCliUtils.java
 ##########
 @@ -115,22 +115,32 @@ public void run() throws IOException {
                 "--expiry-time" }, description = "Relative expiry time for the 
token (eg: 1h, 3d, 10y). (m=minutes) Default: no expiration")
         private String expiryTime;
 
-        @Parameter(names = { "-pk",
-                "--is-private-key" }, description = "Indicate the signing key 
is a private key (rather than a symmetric secret key)")
-        private Boolean isPrivateKey = false;
+        @Parameter(names = { "-sk",
+                "--secret-key" }, description = "Pass the secret key for 
signing the token. This can either be: data:, file:, etc..")
+        private String secretKey;
 
-        @Parameter(names = { "-k",
-                "--signing-key" }, description = "Pass the signing key. This 
can either be: data:, file:, etc..", required = true)
-        private String key;
+        @Parameter(names = { "-pk",
+                "--private-key" }, description = "Pass the private key for 
signing the token. This can either be: data:, file:, etc..")
+        private String privateKey;
 
         public void run() throws Exception {
-            byte[] encodedKey = AuthTokenUtils.readKeyFromUrl(key);
+            if (secretKey == null && privateKey == null) {
+                System.err.println(
+                        "Either --secret-key or --private-key needs to be 
passed for signing a token");
+                System.exit(1);
+            } else if (secretKey != null && privateKey != null) {
+                System.err.println(
+                        "Only one between --secret-key and --private-key needs 
to be passed for signing a token");
 
 Review comment:
   nit: Only one _of_ --secret-key ...

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to