Настройте заполнитель полномочий LDAP, как показано ниже, и он будет работать с вложенными группами:
<bean id="ldapAuthoritiesPopulator" class="org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator">
<constructor-arg ref="ldapContextSource" />
<constructor-arg value="OU=Resource,OU=Security Groups,OU=Administrative Area" /> <!-- group search base -->
<property name="groupRoleAttribute" value="cn" /> <!-- cn is default, but setting it anyway so it's clear -->
<property name="rolePrefix" value="" /> <!-- reset prefix, default is ROLE_ -->
<property name="convertToUpperCase" value="false"/>
<property name="searchSubtree" value="true" /> <!-- deep search -->
<property name="groupSearchFilter" value="(&(&(objectClass=group)(objectCategory=CN=Group,CN=Schema,CN=Configuration,DC=company,DC=local))(&(cn=RG-TRADE*)(member:1.2.840.113556.1.4.1941:={0})))" />
</bean>
Значение groupSearchFilter означает:
objectClass=[group object class] AND objectCategory=[group object category] AND cn_name_of_group=RG-TRADE* AND member:here_magic_for_nested_groups=[user full dn]