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 a4052563b7 [3.0] Set ACL Provider (#10404)
a4052563b7 is described below
commit a4052563b779ba0ee8a67eb717b4060698b6960a
Author: Albumen Kevin <[email protected]>
AuthorDate: Thu Aug 4 15:30:25 2022 +0800
[3.0] Set ACL Provider (#10404)
* [3.0] Set ACL Provider
* fix compile
---
.../registry/zookeeper/util/CuratorFrameworkUtils.java | 14 ++++++++++++++
.../zookeeper/curator5/Curator5ZookeeperClient.java | 14 ++++++++++++++
.../remoting/zookeeper/curator/CuratorZookeeperClient.java | 14 ++++++++++++++
.../boot/context/event/WelcomeLogoApplicationListener.java | 1 -
.../java/org/apache/dubbo/spring/boot/util/DubboUtils.java | 6 +++---
.../org/apache/dubbo/spring/boot/util/DubboUtilsTest.java | 6 +++---
6 files changed, 48 insertions(+), 7 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 9aee1b5bce..7a36a748ce 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
@@ -28,6 +28,7 @@ import org.apache.dubbo.rpc.model.ScopeModelUtil;
import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.framework.api.ACLProvider;
import org.apache.curator.framework.imps.CuratorFrameworkState;
import org.apache.curator.framework.state.ConnectionState;
import org.apache.curator.framework.state.ConnectionStateListener;
@@ -35,6 +36,8 @@ import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.curator.x.discovery.ServiceDiscovery;
import org.apache.curator.x.discovery.ServiceDiscoveryBuilder;
import org.apache.curator.x.discovery.ServiceInstanceBuilder;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.data.ACL;
import java.util.Collection;
import java.util.List;
@@ -76,6 +79,17 @@ public abstract class CuratorFrameworkUtils {
String userInformation = connectionURL.getUserInformation();
if (userInformation != null && userInformation.length() > 0) {
builder = builder.authorization("digest",
userInformation.getBytes());
+ builder.aclProvider(new ACLProvider() {
+ @Override
+ public List<ACL> getDefaultAcl() {
+ return ZooDefs.Ids.CREATOR_ALL_ACL;
+ }
+
+ @Override
+ public List<ACL> getAclForPath(String path) {
+ return ZooDefs.Ids.CREATOR_ALL_ACL;
+ }
+ });
}
CuratorFramework curatorFramework = builder.build();
diff --git
a/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/main/java/org/apache/dubbo/remoting/zookeeper/curator5/Curator5ZookeeperClient.java
b/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/main/java/org/apache/dubbo/remoting/zookeeper/curator5/Curator5ZookeeperClient.java
index 047ddd5940..52c1d9f301 100644
---
a/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/main/java/org/apache/dubbo/remoting/zookeeper/curator5/Curator5ZookeeperClient.java
+++
b/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/main/java/org/apache/dubbo/remoting/zookeeper/curator5/Curator5ZookeeperClient.java
@@ -28,6 +28,7 @@ import org.apache.dubbo.remoting.zookeeper.StateListener;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.framework.api.ACLProvider;
import org.apache.curator.framework.api.CuratorWatcher;
import org.apache.curator.framework.recipes.cache.ChildData;
import org.apache.curator.framework.recipes.cache.NodeCache;
@@ -40,6 +41,8 @@ import org.apache.zookeeper.KeeperException.NoNodeException;
import org.apache.zookeeper.KeeperException.NodeExistsException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.data.ACL;
import org.apache.zookeeper.data.Stat;
import java.nio.charset.Charset;
@@ -75,6 +78,17 @@ public class Curator5ZookeeperClient extends
AbstractZookeeperClient<Curator5Zoo
String userInformation = url.getUserInformation();
if (userInformation != null && userInformation.length() > 0) {
builder = builder.authorization("digest",
userInformation.getBytes());
+ builder.aclProvider(new ACLProvider() {
+ @Override
+ public List<ACL> getDefaultAcl() {
+ return ZooDefs.Ids.CREATOR_ALL_ACL;
+ }
+
+ @Override
+ public List<ACL> getAclForPath(String path) {
+ return ZooDefs.Ids.CREATOR_ALL_ACL;
+ }
+ });
}
client = builder.build();
client.getConnectionStateListenable().addListener(new
CuratorConnectionStateListener(url));
diff --git
a/dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClient.java
b/dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClient.java
index a3216f377a..13a0018178 100644
---
a/dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClient.java
+++
b/dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/org/apache/dubbo/remoting/zookeeper/curator/CuratorZookeeperClient.java
@@ -30,6 +30,7 @@ import org.apache.dubbo.remoting.zookeeper.StateListener;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.framework.api.ACLProvider;
import org.apache.curator.framework.api.CuratorWatcher;
import org.apache.curator.framework.recipes.cache.ChildData;
import org.apache.curator.framework.recipes.cache.NodeCache;
@@ -42,6 +43,8 @@ import org.apache.zookeeper.KeeperException.NoNodeException;
import org.apache.zookeeper.KeeperException.NodeExistsException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.data.ACL;
import org.apache.zookeeper.data.Stat;
import java.nio.charset.Charset;
@@ -79,6 +82,17 @@ public class CuratorZookeeperClient extends
AbstractZookeeperClient<CuratorZooke
String userInformation = url.getUserInformation();
if (StringUtils.isNotEmpty(userInformation)) {
builder = builder.authorization("digest",
userInformation.getBytes());
+ builder.aclProvider(new ACLProvider() {
+ @Override
+ public List<ACL> getDefaultAcl() {
+ return ZooDefs.Ids.CREATOR_ALL_ACL;
+ }
+
+ @Override
+ public List<ACL> getAclForPath(String path) {
+ return ZooDefs.Ids.CREATOR_ALL_ACL;
+ }
+ });
}
client = builder.build();
client.getConnectionStateListenable().addListener(new
CuratorConnectionStateListener(url));
diff --git
a/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/context/event/WelcomeLogoApplicationListener.java
b/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/context/event/WelcomeLogoApplicationListener.java
index c0299f1f96..cb8eeff6d3 100644
---
a/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/context/event/WelcomeLogoApplicationListener.java
+++
b/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/context/event/WelcomeLogoApplicationListener.java
@@ -30,7 +30,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_GITHUB_URL;
import static org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_MAILING_LIST;
-import static
org.apache.dubbo.spring.boot.util.DubboUtils.DUBBO_SPRING_BOOT_GITHUB_URL;
import static org.apache.dubbo.spring.boot.util.DubboUtils.LINE_SEPARATOR;
/**
diff --git
a/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/util/DubboUtils.java
b/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/util/DubboUtils.java
index dae3d8211a..46d7291b9d 100644
---
a/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/util/DubboUtils.java
+++
b/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/main/java/org/apache/dubbo/spring/boot/util/DubboUtils.java
@@ -100,17 +100,17 @@ public abstract class DubboUtils {
/**
* The github URL of Dubbo Spring Boot
*/
- public static final String DUBBO_SPRING_BOOT_GITHUB_URL =
"https://github.com/apache/dubbo-spring-boot-project";
+ public static final String DUBBO_SPRING_BOOT_GITHUB_URL =
"https://github.com/apache/dubbo/tree/3.0/dubbo-spring-boot";
/**
* The git URL of Dubbo Spring Boot
*/
- public static final String DUBBO_SPRING_BOOT_GIT_URL =
"https://github.com/apache/dubbo-spring-boot-project.git";
+ public static final String DUBBO_SPRING_BOOT_GIT_URL =
"https://github.com/apache/dubbo.git";
/**
* The issues of Dubbo Spring Boot
*/
- public static final String DUBBO_SPRING_BOOT_ISSUES_URL =
"https://github.com/apache/dubbo-spring-boot-project/issues";
+ public static final String DUBBO_SPRING_BOOT_ISSUES_URL =
"https://github.com/apache/dubbo/issues";
/**
* The github URL of Dubbo
diff --git
a/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/util/DubboUtilsTest.java
b/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/util/DubboUtilsTest.java
index b99113072f..bbcb245081 100644
---
a/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/util/DubboUtilsTest.java
+++
b/dubbo-spring-boot/dubbo-spring-boot-compatible/autoconfigure/src/test/java/org/apache/dubbo/spring/boot/util/DubboUtilsTest.java
@@ -61,9 +61,9 @@ public class DubboUtilsTest {
Assert.assertEquals("dubbo.config.override",
OVERRIDE_CONFIG_FULL_PROPERTY_NAME);
-
Assert.assertEquals("https://github.com/apache/dubbo-spring-boot-project",
DUBBO_SPRING_BOOT_GITHUB_URL);
-
Assert.assertEquals("https://github.com/apache/dubbo-spring-boot-project.git",
DUBBO_SPRING_BOOT_GIT_URL);
-
Assert.assertEquals("https://github.com/apache/dubbo-spring-boot-project/issues",
DUBBO_SPRING_BOOT_ISSUES_URL);
+
Assert.assertEquals("https://github.com/apache/dubbo/tree/3.0/dubbo-spring-boot",
DUBBO_SPRING_BOOT_GITHUB_URL);
+ Assert.assertEquals("https://github.com/apache/dubbo.git",
DUBBO_SPRING_BOOT_GIT_URL);
+ Assert.assertEquals("https://github.com/apache/dubbo/issues",
DUBBO_SPRING_BOOT_ISSUES_URL);
Assert.assertEquals("https://github.com/apache/dubbo",
DUBBO_GITHUB_URL);