【发布时间】:2018-08-19 16:13:30
【问题描述】:
我正在尝试使用 java 获取 Active Directory rootDSE。到目前为止,这是我尝试过的:
public class RootDSE {
public DirContext context;
public Attributes attributes;
public NamingEnumeration enumerations;
public RootDSE()
{
try {
this.context = new InitialDirContext();
this.attributes = context.getAttributes(
"ldap://192.168.122.115", new String[]{"*"}
);
this.enumerations = this.attributes.getIDs();
while(this.enumerations != null && this.enumerations.hasMore()) {
String nextAttribute = (String)this.enumerations.next();
System.out.println(attributes.get(nextAttribute));
}
context.close();
} catch (NamingException e) {
e.printStackTrace();
}
}
}
(我评论了imports 以使阅读更容易。
我通过创建 RootDSE 对象来启动代码:
RootDSE dse = new RootDSE();
javax.naming.NamingException: [LDAP: error code 1 - 000004DC: LdapErr: DSID-0C090728, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, v2580
我已经执行了经过身份验证的 ldap 请求,因此授予了网络连接和对目录服务的访问权限。此外,rootDSE 请求应该是匿名的?不需要执行“successful bind”来获取它吗?
谁能解释我为什么会收到这个错误,以及如何解决它?
非常感谢!
【问题讨论】:
-
搜索前可获取所有BaseDN:stackoverflow.com/a/2616530/1947962
标签: java active-directory