[英]how to specify search scope and returning attributes together for ldap DirContext.search(…)
[英]Specify LDAP group search attributes in Jetty LdapLoginModule
使用JAAS时,有没有办法指定角色(组)搜索查询返回的属性?
返回的组在uniqueMember
属性中有大约100k条目,这使得应用服务器和OpenLDAP之间的链接饱和。 由于查询只需要cn
属性,我想告诉容器只在执行搜索时请求。
目前,查询未设置任何要返回的属性,这将返回所有属性。
DEV(Jetty) java.security.auth.login.config
看起来像这样
devldap {
org.eclipse.jetty.plus.jaas.spi.LdapLoginModule required
debug="true"
contextFactory="com.sun.jndi.ldap.LdapCtxFactory"
hostname="ldap-dev.example.com"
port="389"
bindDn="cn=Manager,dc=example,dc=com"
bindPassword="xxxx"
authenticationMethod="simple"
forceBindingLogin="true"
userBaseDn="ou=users,dc=example,dc=com"
userRdnAttribute="uid"
userIdAttribute="uid"
userPasswordAttribute="userPassword"
userObjectClass="inetOrgPerson"
roleBaseDn="ou=groups,dc=example,dc=com"
roleNameAttribute="cn"
roleMemberAttribute="uniqueMember"
roleObjectClass="groupOfUniqueNames";
};
那里有严重的错误。 它根本不应该返回组条目属性,只有CN。
这看起来像是org.eclipse.jetty.plus.jaas.spi.LdapLoginModule中的一个主要错误。 它应该将SearchControl
的returningAttributes
属性设置为getUserRolesByDn()
new String[]{_roleNameAttribute}
。 您需要自己报告和/或修补它。
如果您使用的是OpenLDAP,可以考虑使用memberOf
overlay。 这为用户自己提供了列出他所属的所有组的属性。 然而,它不是回顾性的,并且由于您已经清楚地拥有一个大型目录,因此您可以从现有组中填充它。 覆盖层将在安装后自动维护,但仅适用于安装后发生的组更新。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.