pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] maskit commented on a change in pull request #2888: PIP-25: Token based authentication
Date Tue, 27 Nov 2018 22:12:58 GMT
maskit commented on a change in pull request #2888: PIP-25: Token based authentication
URL: https://github.com/apache/pulsar/pull/2888#discussion_r236867771
 
 

 ##########
 File path: pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/utils/AuthTokenUtils.java
 ##########
 @@ -90,39 +92,18 @@ public static String createToken(Key signingKey, String subject, Optional<Date>
     }
 
     public static byte[] readKeyFromUrl(String keyConfUrl) throws IOException {
-        if (keyConfUrl.startsWith("data:")) {
-            return readDataUrl(keyConfUrl);
+        if (keyConfUrl.startsWith("data:") || keyConfUrl.startsWith("file:")) {
+            try {
+                return ByteStreams.toByteArray((InputStream) new URL(keyConfUrl).getContent());
+            } catch (Exception e) {
+                throw new IOException(e);
+            }
         } else if (keyConfUrl.startsWith("env:")) {
 
 Review comment:
   I think we shoudn’t define encoding field on env scheme to keep it simple. The requirement
comes from application use case (which is this plugin here), so the application should take
care of it.
   If you get URLConnection from the URL object, you can check the scheme name as protocol
name.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message