apache / pulsar

Apache Pulsar - distributed pub-sub messaging system
https://pulsar.apache.org/
Apache License 2.0
14.26k stars 3.59k forks source link

[fix][client] Initializing client-authentication using configured auth params #23610

Open rdhabalia opened 7 hours ago

rdhabalia commented 7 hours ago

Motivation

Currently, there are user applications that want to load client configurations dynamically from a config file and create PulsarClient by passing that dynamically created ClientConfigurationData. In that case, the Pulsar client doesn't initialize authentication with provided auth parameters and authPluginClass into ClientConfigurationData, so user applications are not able to configure authentication correctly. Therefore, PulsarClient should initialize authentication based on provided auth configuration (param and auth-class) and use it for server connection.

Modifications

Pulsar client lib can initialize authentication using configured auth-param and class into client-configuration.

Verifying this change

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

Documentation

Matching PR in forked repository

PR in forked repository:

codecov-commenter commented 6 hours ago

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 74.33%. Comparing base (bbc6224) to head (a75a7c9). Report is 735 commits behind head on master.

Files with missing lines Patch % Lines
...g/apache/pulsar/client/impl/ClientBuilderImpl.java 50.00% 0 Missing and 1 partial :warning:
Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/apache/pulsar/pull/23610/graphs/tree.svg?width=650&height=150&src=pr&token=acYqCpsK9J&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/pulsar/pull/23610?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) ```diff @@ Coverage Diff @@ ## master #23610 +/- ## ============================================ + Coverage 73.57% 74.33% +0.75% - Complexity 32624 34961 +2337 ============================================ Files 1877 1944 +67 Lines 139502 147129 +7627 Branches 15299 16226 +927 ============================================ + Hits 102638 109362 +6724 - Misses 28908 29316 +408 - Partials 7956 8451 +495 ``` | [Flag](https://app.codecov.io/gh/apache/pulsar/pull/23610/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | |---|---|---| | [inttests](https://app.codecov.io/gh/apache/pulsar/pull/23610/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `27.33% <50.00%> (+2.75%)` | :arrow_up: | | [systests](https://app.codecov.io/gh/apache/pulsar/pull/23610/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `24.38% <50.00%> (+0.06%)` | :arrow_up: | | [unittests](https://app.codecov.io/gh/apache/pulsar/pull/23610/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `73.70% <50.00%> (+0.85%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files with missing lines](https://app.codecov.io/gh/apache/pulsar/pull/23610?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | |---|---|---| | [...g/apache/pulsar/client/impl/ClientBuilderImpl.java](https://app.codecov.io/gh/apache/pulsar/pull/23610?src=pr&el=tree&filepath=pulsar-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fclient%2Fimpl%2FClientBuilderImpl.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWNsaWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2NsaWVudC9pbXBsL0NsaWVudEJ1aWxkZXJJbXBsLmphdmE=) | `86.54% <50.00%> (+0.56%)` | :arrow_up: | ... and [660 files with indirect coverage changes](https://app.codecov.io/gh/apache/pulsar/pull/23610/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)

🚨 Try these New Features: