Spring 的 LdapTemplate 搜索:PartialResultException: Unprocessed Continuation Reference(s);剩下的名字'/' [英] Spring's LdapTemplate search: PartialResultException: Unprocessed Continuation Reference(s); remaining name '/'

查看:128
本文介绍了Spring 的 LdapTemplate 搜索:PartialResultException: Unprocessed Continuation Reference(s);剩下的名字'/'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过 LDAP 为某个使用 spring 制作的应用程序添加用户.

I add users through LDAP for a certain application, made with spring.

虽然这适用于大多数情况,但在某些情况下,它不起作用......

While this works for most of the cases, in some cases, it does not work...

检索我使用的用户:

public class LdapUserServiceImpl implements ILdapUserService {

    @Override
    public List<LdapUserVO> getUserNamesByQuery(String query) {
        return ldapTemplate.search(
            query().countLimit(15)
                    .where("objectClass").is("user")
                    .and("sAMAccountName").isPresent()
                    .and(query()
                            .where("sAMAccountName").like("*" + query + "*")
                            .or("sAMAccountName").is(query)
                            .or("displayName").like("*" + query + "*")
                            .or("displayName").is(query))
            ,
            new AttributesMapper<LdapUserVO>() {
                public LdapUserVO mapFromAttributes(Attributes attrs) throws NamingException {
                    LdapUserVO ldapUser = new LdapUserVO();
                    Attribute attr = attrs.get(ldapUserSearch);
                    if (attr != null && attr.get() != null) {
                        ldapUser.setUserName(attr.get().toString());
                    }
                    attr = attrs.get("displayName");
                    if (attr != null && attr.get() != null) {
                        ldapUser.setDisplayName(attr.get().toString());
                    }
                    return ldapUser;
                }
            });
    }
}

所以这在大多数情况下都有效,但有时我会收到以下错误:

So this works in most of the cases, but sometimes I get the following error:

unprocessed continuation reference(s); remaining name "/"

我已经搜索了很多关于这个,我明确设置

I've searched a lot about this, and I explicitly set

DefaultSpringSecurityContextSource ctxSrc = new DefaultSpringSecurityContextSource(ldapUrl);
ctxSrc.setReferral("follow");

更多信息:

  • 搜索查询admin_a"有效,但admin_ah"无效
  • Spring 版本是 4.2.5.RELEASE
  • Spring ldap-core 版本为 2.0.2.RELEASE

我觉得奇怪的是剩下的名字是根目录......有人知道如何解决这个问题,甚至从哪里开始寻找?

I think it strange that the remaining name is the root directory... Does someone has any ideas how to fix this, or even where to start looking?

提前致谢!

推荐答案

这可能与 Active Directory 无法自动处理引用有关.请看一下 LdapTemplate javadoc.

This may be related with the Active Directory being unable to handle referrals automatically. Please take a look at the LdapTemplate javadoc.

如果是这种情况,请在 ldapTemplate 配置中将 ignorePartialResultException 属性设置为 true.

If this is the case, set the ignorePartialResultException property to true in your ldapTemplate configuration.

这篇关于Spring 的 LdapTemplate 搜索:PartialResultException: Unprocessed Continuation Reference(s);剩下的名字'/'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆