onobc commented on code in PR #18358:
URL: https://github.com/apache/pulsar/pull/18358#discussion_r1014915336
##########
pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/PulsarAdminImpl.java:
##########
@@ -215,13 +212,35 @@ public PulsarAdminImpl(String serviceUrl,
}
}
+ private Authentication determineAuth(ClientConfigurationData conf) throws
PulsarClientException {
+ if (conf == null) {
+ return new AuthenticationDisabled();
+ }
+ maybeSetAuthOnConf(conf);
+ return conf.getAuthentication();
+ }
+
+ private void maybeSetAuthOnConf(ClientConfigurationData conf) throws
PulsarClientException {
+ if (StringUtils.isBlank(conf.getAuthPluginClassName())
+ || (StringUtils.isBlank(conf.getAuthParams()) &&
conf.getAuthParamMap() == null)) {
+ return;
+ }
+ if (StringUtils.isNotBlank(conf.getAuthParams())) {
+
conf.setAuthentication(AuthenticationFactory.create(conf.getAuthPluginClassName(),
+ conf.getAuthParams()));
+ } else {
+
conf.setAuthentication(AuthenticationFactory.create(conf.getAuthPluginClassName(),
+ conf.getAuthParamMap()));
+ }
+ }
+
/**
* Construct a new Pulsar Admin client object.
* <p/>
* This client object can be used to perform many subsquent API calls
*
* @param serviceUrl
- * the Pulsar service URL (eg.
"http://my-broker.example.com:8080")
+ * the Pulsar service URL (eg.
'http://my-broker.example.com:8080')
Review Comment:
**[UNRELATED]** warning on checks and single quote less likely to cause
render problems in javadoc.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]