- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试从LDAP服务器中获取所有用户,并从基础上进行搜索,这是我的代码:
public LdapTemplate ldapTemplate() {
LdapContextSource ctxSrc = new LdapContextSource();
ctxSrc.setUrl("ldap://127.0.0.1:389/");
ctxSrc.setBase("dc=test,dc=com");
ctxSrc.setUserDn("admin");
ctxSrc.setPassword("password");
ctxSrc.afterPropertiesSet();
LdapTemplate lt = new LdapTemplate(ctxSrc);
return lt;
}
private LdapTemplate ldapTemplate = ldapTemplate();
public List<User> getAllUsers() {
LdapQuery query= query().base("").where("objectclass").is("user");
return ldapTemplate.search(query, new UserAttributesMapper());
}
10:07:09.406 [main] DEBUG o.s.l.c.s.AbstractContextSource - AuthenticationSource not set - using default implementation
10:07:09.413 [main] DEBUG o.s.l.c.s.AbstractContextSource - Not using LDAP pooling
10:07:09.416 [main] DEBUG o.s.l.c.s.AbstractContextSource - Trying provider Urls: ldap://127.0.0.1:389/dc=test,dc=com
10:07:09.548 [main] DEBUG o.s.l.c.s.AbstractContextSource - Got Ldap context on server 'ldap://127.0.0.1:389/dc=test,dc=com'
Exception in thread "main" org.springframework.ldap.PartialResultException: Unprocessed Continuation Reference(s); nested exception is javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name '/'
at org.springframework.ldap.support.LdapUtils.convertLdapException(LdapUtils.java:216)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:385)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:309)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:616)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:586)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:1651)
at ldap.example.UserRepositoryImpl.getAllUsers(UserRepositoryImpl.java:81)
at ldap.example.test.LdapApp.main(LdapApp.java:23)
Caused by: javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name '/'
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2914)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2888)
at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.getNextBatch(AbstractLdapNamingEnumeration.java:148)
at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMoreImpl(AbstractLdapNamingEnumeration.java:217)
at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMore(AbstractLdapNamingEnumeration.java:189)
at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:365)
... 6 more
BUILD FAILED (total time: 1 second)
ou
过滤时,它可以工作,但是我需要从根目录过滤。
最佳答案
您在有问题的评论中写道,更改端口会有所帮助。
但是更改端口并不能解决此问题。3268
端口指向Active Directory特殊位置-全局目录。所有对象都有一组-但每个对象只有一小部分属性(例如distinguishedName,cn,sAMAccountName ...)。
所以-它起作用,直到您不需要更多特定的属性为止。
问题分析
发生异常是因为查询的结果是AD返回referral objects:
[Active Directory] (...) generate referrals in response to queries that request data about objects that exist in the forest, but not contained on the directory server handling the request. These are called internal cross references, because they refer to domains, schema, and configuration containers within the forest.
If referral chasing is not enabled and a subtree search is performed, the search will return all objects within the specified domain that meet the search criteria. The search will also return referrals to any subordinate domains that are direct descendants of the directory server domain. The client must resolve the referrals by binding to the path specified by the referral and submitting another query.
ctxSrc.setBase()
方法。也许您的所有用户都在内部路径内,例如
"ou=user,dc=department,dc=test,dc=com"
。
LdapTemplate
中,您还可以使用
setIgnorePartialResultException()方法忽略此异常:
ldapTemplate.setIgnorePartialResultException(true);
关于Spring LDAP querybuilder PartialResultException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43041282/
我正在尝试从LDAP服务器中获取所有用户,并从基础上进行搜索,这是我的代码: public LdapTemplate ldapTemplate() { LdapContextSourc
我们在日志中看到此警告消息 javax.naming.PartialResultException:未处理的延续引用;剩余名称 'dc=global,dc=com' 每当用户登录我们的应用程序时,它就
我们在日志中看到此警告消息 javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining
我的 spring security xml 文件中有以下配置。当我尝试进行身份验证时,我收到以下消息但无法继续。 信息:忽略 PartialResultException 我知道 spring 的文
我基本上是在 Active Directory 中遍历 LDAP 树。 在每个级别我查询 "(objectClass=*)" .当我在根上执行此操作时,例如 "dc=example,dc=com"我得
我目前正在使用 Spring Boot 创建一个新的 Web 应用程序,并开始集成 Spring Security 以进行身份验证。成功后基于Spring Boot LDAP tutorial ,
我正在尝试设置我们的新 Grails 应用程序以通过 LDAP 进行身份验证。从日志中我们可以看到 Acegi 正在绑定(bind)到 LDAP 存储,然后能够找到给定正确凭据的用户,最后开始搜索角色
我已经在 stackoverflow 上阅读了几乎所有关于 Spring/Security/Ldap 和 ActiveDirectory 的内容。即使我找到了有用的提示和提示,我也无法解决我的问题。
我将 LDAP DirContext.search(...) 设置为忽略引用,但是当我调用 NamingEnumeration.hasMore() 时,我仍然得到一个引用异常。 Exception i
我通过 LDAP 为某个应用程序添加用户,使用 spring。 虽然这适用于大多数情况,但在某些情况下,它不起作用...... 检索我使用的用户: public class LdapUserServi
我是一名优秀的程序员,十分优秀!