forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve AuthTokenUtils to support a valid key file path. (apache#6607)
### Motivation Some users may confuse by using `bin/pulsar tokens create` or `validate` with option `--secret-key` or `--private-key` at first time like below: ``` $ bin/pulsar tokens create --secret-key /opt/test-secret.key --subject test-user Exception in thread "main" io.jsonwebtoken.io.DecodingException: Illegal base64 character: '-' at io.jsonwebtoken.io.Base64.ctoi(Base64.java:206) at io.jsonwebtoken.io.Base64.decodeFast(Base64.java:255) at io.jsonwebtoken.io.Base64Decoder.decode(Base64Decoder.java:21) at io.jsonwebtoken.io.Base64Decoder.decode(Base64Decoder.java:8) at io.jsonwebtoken.io.ExceptionPropagatingDecoder.decode(ExceptionPropagatingDecoder.java:21) at org.apache.pulsar.broker.authentication.utils.AuthTokenUtils.readKeyFromUrl(AuthTokenUtils.java:115) at org.apache.pulsar.utils.auth.tokens.TokensCliUtils$CommandCreateToken.run(TokensCliUtils.java:149) at org.apache.pulsar.utils.auth.tokens.TokensCliUtils.main(TokensCliUtils.java:320) ``` Current usage should specify file path starting with "file:///opt/cmss-secret.key". ### Modifications Add support to read key from a valid file path in `AuthTokenUtils.readKeyFromUrl`.
- Loading branch information
Showing
2 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters