This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.0 by this push:
new a934502916 buildCuratorFramework method add zk digest acl support when
use zk instance discovery (#10247)
a934502916 is described below
commit a934502916059af756d50c50003865c9b1857163
Author: sage.xue <[email protected]>
AuthorDate: Fri Jul 1 14:19:03 2022 +0800
buildCuratorFramework method add zk digest acl support when use zk instance
discovery (#10247)
---
.../dubbo/registry/zookeeper/util/CuratorFrameworkUtils.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git
a/dubbo-registry/dubbo-registry-zookeeper/src/main/java/org/apache/dubbo/registry/zookeeper/util/CuratorFrameworkUtils.java
b/dubbo-registry/dubbo-registry-zookeeper/src/main/java/org/apache/dubbo/registry/zookeeper/util/CuratorFrameworkUtils.java
index f3d43c64e5..9aee1b5bce 100644
---
a/dubbo-registry/dubbo-registry-zookeeper/src/main/java/org/apache/dubbo/registry/zookeeper/util/CuratorFrameworkUtils.java
+++
b/dubbo-registry/dubbo-registry-zookeeper/src/main/java/org/apache/dubbo/registry/zookeeper/util/CuratorFrameworkUtils.java
@@ -70,10 +70,14 @@ public abstract class CuratorFrameworkUtils {
}
public static CuratorFramework buildCuratorFramework(URL connectionURL,
ZookeeperServiceDiscovery serviceDiscovery) throws Exception {
- CuratorFramework curatorFramework = CuratorFrameworkFactory.builder()
+ CuratorFrameworkFactory.Builder builder =
CuratorFrameworkFactory.builder()
.connectString(connectionURL.getBackupAddress())
- .retryPolicy(buildRetryPolicy(connectionURL))
- .build();
+ .retryPolicy(buildRetryPolicy(connectionURL));
+ String userInformation = connectionURL.getUserInformation();
+ if (userInformation != null && userInformation.length() > 0) {
+ builder = builder.authorization("digest",
userInformation.getBytes());
+ }
+ CuratorFramework curatorFramework = builder.build();
curatorFramework.getConnectionStateListenable().addListener(new
CuratorConnectionStateListener(connectionURL, serviceDiscovery));