-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[improve][authentication] Improve get the basic authentication config #16526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
gaoran10
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
464ee32 to
8e2a324
Compare
| # basicAuthConf=/path/my/.htpasswd | ||
| # use Base64 to encode the contents of .htpasswd: | ||
| # basicAuthConf=YOUR-BASE64-DATA | ||
| basicAuthConf= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| basicAuthConf= | |
| basicAuthInBase64= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to add two config?
basicAuthInBase64=YOUR-BASE64-DATA
basicAuthInFile=/path/to/basic
| if (org.apache.commons.codec.binary.Base64.isBase64(data)) { | ||
| reader = new BufferedReader(new StringReader(new String(Base64.getDecoder().decode(data), | ||
| StandardCharsets.UTF_8))); | ||
| } else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can use 2 different config/property names instead of checking isBase64, the isBase64(path) maybe return true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can add a prefix so like:
basicAuthConf=data:;base64,YOUR-BASE64
basicAuthConf=file:///my/basic.conf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nodece Could you please update the PR as your description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codelipenghui This PR has been merged into master, this config still keep old style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me open a new PR to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to #16935.
Signed-off-by: Zixuan Liu <nodeces@gmail.com>
8e2a324 to
d7caf76
Compare
…apache#16526) Signed-off-by: Zixuan Liu <nodeces@gmail.com> (cherry picked from commit d32e1df) Signed-off-by: Zixuan Liu <nodeces@gmail.com>
|
When cherry-picking this PR to branch-2.x, we also need to cherry-pick the #16935 to the same branch. |
|
Move |
…apache#16526) Signed-off-by: Zixuan Liu <nodeces@gmail.com> (cherry picked from commit d32e1df) Signed-off-by: Zixuan Liu <nodeces@gmail.com>
|
Move |
…apache#16526) Signed-off-by: Zixuan Liu <nodeces@gmail.com> (cherry picked from commit d32e1df) (cherry picked from commit aaedacf)
…apache#16526) Signed-off-by: Zixuan Liu <nodeces@gmail.com>
Signed-off-by: Zixuan Liu nodeces@gmail.com
Motivation
Right now the Pulsar only supports getting the basic authentication config from the system properties, I suggest reading it from the Pulsar config file, so like:
Modifications
basicAuthConfto the config file for use in reading the basic authentication configDocumentation
doc-requiredAdd
basicAuthConfto Refrences page.doc-complete- [improve][doc] Add more configuration methods for basic authentication #16941