maskit commented on a change in pull request #2888: PIP-25: Token based
authentication
URL: https://github.com/apache/pulsar/pull/2888#discussion_r236869693
##########
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 didn’t read key generation part, but if the key is in PEM format we can
use the same format for all scheme and decode the raw data read from the
InputStream in a consistent way, I think.
----------------------------------------------------------------
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