gpt4 book ai didi

java - Spring LDAP 无法从 AD LDS 读取

转载 作者:太空宇宙 更新时间:2023-11-04 12:00:08 24 4
gpt4 key购买 nike

我目前有一个 Spring-boot 应用程序,它从 Active Directory 获取员工数据,并将其显示为 JSON。

但是,我不想直接链接到 Active Directory,我想使用 Active Directory 轻量级服务。

我以为我可以设置连接并以相同的方式进行连接,但我不断收到错误 49(无效凭据)错误。我使用与 Active Directory 相同的凭据。

这是 Spring.xml 配置凭据:

 <bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource">
<property name="url" value="ldap://example.com:389" />
<property name="base" value=" DC=example,DC=com" />
<property name="userDn" value="jsmith@example.com" />
<property name="password" value="password" />
</bean>

<bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate">
<constructor-arg ref="contextSource" />
<property name="ignorePartialResultException" value="true" />
</bean>

如果我尝试将 url 更改为 AD LDS url(使用 localhost),我会收到 Ldap 错误 49。有人有使用这些技术的经验吗?请帮忙。

编辑:

如果我尝试使用我的 Active Directory 域用户名,我会得到:

The authentication failed
- [LDAP: error code 49 - 8009030C: LdapErr: DSID-0C0903C4, comment: AcceptSecurityContext error, data 2030, v295a

如果我尝试使用 userDN,我会得到:

The authentication failed
- [LDAP: error code 80 - 80090304: LdapErr: DSID-0C0903C4, comment: AcceptSecurityContext error, data 20ee, v295a

最佳答案

您需要提供用户的完整 DN 作为“userDn”,例如 cn=jsmith@example.com,ou=xyz,dc=abc,dc-com。

关于java - Spring LDAP 无法从 AD LDS 读取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40990342/

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