提交 6dd6226f 编写于 作者: W william.liangf

DUBBO-351 zookeeper注册中心权限验证不能通过

git-svn-id: http://code.alibabatech.com/svn/dubbo/trunk@1606 1a56cb94-b969-4eaa-88fa-be21384802f2
上级 d062ff6a
...@@ -253,6 +253,15 @@ public final class URL implements Serializable { ...@@ -253,6 +253,15 @@ public final class URL implements Serializable {
public String getPassword() { public String getPassword() {
return password; return password;
} }
public String getAuthority() {
if ((username == null || username.length() == 0)
&& (password == null || password.length() == 0)) {
return null;
}
return (username == null ? "" : username)
+ ":" + (password == null ? "" : password);
}
public String getHost() { public String getHost() {
return host; return host;
......
...@@ -249,7 +249,7 @@ public class ZookeeperRegistry extends FailbackRegistry { ...@@ -249,7 +249,7 @@ public class ZookeeperRegistry extends FailbackRegistry {
} }
}); });
if (auth) { if (auth) {
zk.addAuthInfo(url.getUsername(), url.getPassword().getBytes()); zk.addAuthInfo("digest", url.getAuthority().getBytes());
} }
return zk; return zk;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册