1
我正在使用Spring Security和Spring LDAP开发应用程序。 这是我的弹簧security.xml文件的一部分:Spring LDAP 3.1定制用户映射器
<authentication-manager alias="authenticationManager">
<ldap-authentication-provider
user-search-filter="sAMAccountName={0}"
user-search-base="OU=UK,OU=Domain Objects,dc=test,dc=test1"
group-search-filter="member={0}"
group-search-base="OU=_Groups,OU=UK,OU=Domain Objects,dc=test,dc=test1"
group-role-attribute="cn"
role-prefix="ROLE_">
</ldap-authentication-provider>
</authentication-manager>
<ldap-server url="ldap://host:389/"
manager-dn="managerUser"
manager-password="ManagerPassword" />
现在我需要做一个用户属性的一些逻辑。我想知道是否有一种方法可以在登录阶段获得该属性,或者每次需要该属性时都需要在LDAP上进行搜索。
现在在线我有点困惑,因为我在网上找到许多方法来获取自定义属性:在DAO或AbstractContextMapper中扩展ContextMapper或扩展LdapUserDetailsMapper。
你能帮我找到正确的解决方案吗?我认为最好的办法是在登录阶段有一个可以放置我需要的属性的对象,而不是在每次需要该属性时查询LDAP。 谢谢