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

 ##########
 File path: 
pulsar-broker/src/main/java/org/apache/pulsar/utils/auth/tokens/TokensCliUtils.java
 ##########
 @@ -0,0 +1,231 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.utils.auth.tokens;
+
+import com.beust.jcommander.JCommander;
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+import com.google.common.base.Charsets;
+
+import io.jsonwebtoken.SignatureAlgorithm;
+import io.jsonwebtoken.io.Decoders;
+import io.jsonwebtoken.io.Encoders;
+import io.jsonwebtoken.security.Keys;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.security.Key;
+import java.security.KeyPair;
+import java.util.Date;
+import java.util.Optional;
+import java.util.concurrent.TimeUnit;
+
+import javax.crypto.SecretKey;
+
+import lombok.Cleanup;
+
+import org.apache.pulsar.broker.authentication.utils.AuthTokenUtils;
+import org.apache.pulsar.common.util.RelativeTimeUtil;
+
+public class TokensCliUtils {
+
+    public static class Arguments {
+        @Parameter(names = { "-h", "--help" }, description = "Show this help 
message")
+        private boolean help = false;
+    }
+
+    @Parameters(commandDescription = "Create a new secret key")
+    public static class CommandCreateSecretKey {
+        @Parameter(names = { "-a",
+                "--signature-algorithm" }, description = "The signature 
algorithm for the new secret key.")
+        SignatureAlgorithm algorithm = SignatureAlgorithm.HS256;
+
+        @Parameter(names = { "-o",
+                "--output" }, description = "Write the secret key to a file 
instead of stdout")
+        String outputFile;
+
+        @Parameter(names = {
+                "-b", "--base-64" }, description = "Encode the key in base64")
 
 Review comment:
   I thought about that, but don't know which option is more confusing

----------------------------------------------------------------
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