这个版本仍在开发中,目前尚未被认为是稳定的。要使用最新稳定版本,请使用 Spring LDAP 4.0.2spring-doc.cadn.net.cn

实用工具

本部分描述了您可以与Spring LDAP一起使用的额外工具。spring-doc.cadn.net.cn

增量检索多值属性

当一个特定属性的属性值数量非常大(>1500)时,Active Directory 通常不会一次返回所有这些值。相反,属性值是根据 多值属性的增量检索 方法返回的。这样做需要调用方检查返回的属性中的特定标记,并在必要时进行额外的查找请求,直到找到所有值。spring-doc.cadn.net.cn

Spring LDAP 的 org.springframework.ldap.core.support.DefaultIncrementalAttributesMapper 在处理此类属性时很有帮助,如下所示:spring-doc.cadn.net.cn

Object[] attrNames =  new Object[]{"oneAttribute", "anotherAttribute"};
Attributes attrs = DefaultIncrementalAttributeMapper.lookupAttributes(ldapTemplate, theDn, attrNames);

前述示例会解析任何返回的属性范围标记,并在必要时进行重复请求,直到所有请求属性的所有值都已获取。spring-doc.cadn.net.cn