Spring的LdapTemplate搜索:PartialResultException:未处理的连续引用;剩余名称"/" [英] Spring's LdapTemplate search: PartialResultException: Unprocessed Continuation Reference(s); remaining name '/'

查看:1126
本文介绍了Spring的LdapTemplate搜索:PartialResultException:未处理的连续引用;剩余名称"/"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过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"无效
  • 春季版本为4.2.5.RELEASE
  • 春季ldap-core版本是2.0.2.释放

我觉得奇怪的是,剩下的名字是根目录...有人对如何解决这个问题,甚至从哪里开始有任何想法吗?

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:未处理的连续引用;剩余名称"/"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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