You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/05/18 13:22:07 UTC

[GitHub] [pulsar] atezs82 commented on a change in pull request #10574: [Issue 905][api][pulsar-client] add serializable token class

atezs82 commented on a change in pull request #10574:
URL: https://github.com/apache/pulsar/pull/10574#discussion_r634371912



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/auth/AuthenticationToken.java
##########
@@ -107,4 +101,38 @@ public void start() throws PulsarClientException {
         // noop
     }
 
+    public static class SerializableURITokenSupplier implements Supplier<String>, Serializable {
+
+        private static final long serialVersionUID = 3160666668166028760L;
+        private URI uri;
+
+        public SerializableURITokenSupplier(final URI uri) {
+            super();
+            this.uri = uri;
+        }
+
+        @Override
+        public String get() {
+            try {
+                return new String(Files.readAllBytes(Paths.get(uri)), Charsets.UTF_8).trim();
+            } catch (IOException e) {
+                throw new RuntimeException("Failed to read token from file", e);
+            }
+        }
+    }
+
+    public static class SerializableTokenSupplier implements Supplier<String>, Serializable {
+
+        private static final long serialVersionUID = 5095234161799506913L;
+        private String token;

Review comment:
       Done.

##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/auth/AuthenticationToken.java
##########
@@ -107,4 +101,38 @@ public void start() throws PulsarClientException {
         // noop
     }
 
+    public static class SerializableURITokenSupplier implements Supplier<String>, Serializable {
+
+        private static final long serialVersionUID = 3160666668166028760L;
+        private URI uri;

Review comment:
       Done.

##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/auth/AuthenticationToken.java
##########
@@ -107,4 +101,38 @@ public void start() throws PulsarClientException {
         // noop
     }
 
+    public static class SerializableURITokenSupplier implements Supplier<String>, Serializable {

Review comment:
       Done.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org