gpt4 book ai didi

java - 如何使用 UnboundID LDAP SDK 连接到本地主机?

转载 作者:太空宇宙 更新时间:2023-11-04 07:29:33 28 4
gpt4 key购买 nike

如何使用 UnboundID LDAP SDK 连接到本地主机?我认为这很简单,但也许不是。我使用以下代码连接得很好,但我希望可以选择仅使用 locahost 连接而不必进行身份验证。

通过连接,我执行了一系列添加/删除/修改,这与下面的连接配合良好。

public LDAPConnection connect(LdapConnectionModel connectionModel)
{
this.connectionModel = connectionModel;
try
{
// Determine is SSL port was specified
int port = connectionModel.isSslEnabled() ? SSL_PORT : PORT;

// Determined bind DN
String bindDN = connectionModel.getUsername() + "@" + connectionModel.getDomain();

// Connect
connection = new LDAPConnection(connectionModel.getHost(), port, bindDN, String.valueOf(connectionModel.getPassword()));

// Clear out our password
connectionModel.setPassword(new char[] {});
}
catch (LDAPException e)
{
LOG.warning("CONNECTION FAILED: " + e.getMessage());
LOG.warning(e.getMessage());
}
return connection;
}

例如,获得这样的连接很好,但随后我收到此错误:“为了执行此操作,必须在连接上成功完成 bing。”

// Connect
connection = new LDAPConnection("localhost",389);

最佳答案

目录服务器运行的位置或主机上没有任何区别。当 LDAP 客户端连接到服务器时,该连接未经身份验证。 LDAP 客户端必须使用 BIND 请求来请求服务器将连接的授权状态更改为允许 LDAP 客户端所需操作的状态。

另请参阅

关于java - 如何使用 UnboundID LDAP SDK 连接到本地主机?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17953197/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com