我在基于春季的webapp中使用Windows来查询驻留在Windows 2012上的SpringLDAP。以下是我的环境详细信息:- Java 1.8.0_101、apache-tomcat-8.0.36、SpringMVC 4.3.1和SpringLDAP 2.3.1
以下AD过滤器查询获取基于windows (C++/C# )查询工具(例如Lepide AD查询工具)和eclipse中的LDAP浏览器插件中的匹配帐户,但是在基于Java的应用程序JXplorer中使用时不会获取匹配的记录/AD帐户:
(&(objectclass=user)(objectCategory=person)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(accountExpires>=131554368000000000)(userPrincipalName=cgm@*))我正在尝试获取一个用户帐户,该帐户是活动的,在给定日期并以字符串userPrincipalName cgm@开头的cgm@值的情况下尚未过期。
以下是spring-servlet.xml文件中的ldap配置:
<util:map id="ldapBaseEnvProps">
<entry key="java.naming.ldap.attributes.binary" value="objectGUID"/>
</util:map>
<ldap:context-source id="pooledLdapContextSrc" url="ldap://dc.myadserver.com:3268" base="DC=myadserver,DC=com" username="CN=adusername,OU=Mkt-Managers,DC=myadserver,DC=com" password="*****" base-env-props-ref="ldapBaseEnvProps">
<ldap:pooling max-total="16" max-active="16" max-idle="8" min-idle="0" max-wait="90000" when-exhausted="BLOCK" test-on-borrow="true" test-while-idle="true"/>
</ldap:context-source>Java/SpringLDAP API完全支持这样的AD过滤器吗?如果是,则需要更改上面的AD查询筛选器才能在基于Java的代码中工作(获取匹配的AD帐户)?
发布于 2017-11-20 21:26:23
我建议在Java中使用Spring的查询生成器对象来帮助您构建该查询。您的问题似乎表明您将该查询从C (windows)环境复制到Java环境中。
首先,在Spring中使用.where()函数构建查询,并查看它是否会导致相同的错误:https://docs.spring.io/spring-ldap/docs/current/apidocs/org/springframework/ldap/query/LdapQueryBuilder.html
https://stackoverflow.com/questions/47332144
复制相似问题