有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java理解spring ldap中过滤器的含义

.userSearchBase("ou=people")
.userSearchFilter("(uid={0})")
.groupSearchBase("ou=groups")
.groupSearchFilter("member={0}")

谁能解释一下这些过滤器是什么意思吗
basesearch过滤器之间有什么区别?此外,这是什么意思


共 (1) 个答案

  1. # 1 楼答案

    根据documentation

    public LdapAuthenticationProviderConfigurer<B> userSearchBase(String userSearchBase)
    

    Search base for user searches. Defaults to "". Only used with userSearchFilter(String). Parameters: userSearchBase - search base for user searches Returns: the LdapAuthenticationProviderConfigurer for further customizations

    user-search-base用于指向 查找用户信息

    public LdapAuthenticationProviderConfigurer<B> userSearchFilter(String userSearchFilter)
    

    The LDAP filter used to search for users (optional). For example "(uid={0})". The substituted parameter is the user's login name. Parameters: userSearchFilter - the LDAP filter used to search for users Returns: the LdapAuthenticationProviderConfigurer for further customizations

    user-search-filter是包含用户名的属性名

    public LdapAuthenticationProviderConfigurer<B> groupSearchBase(String groupSearchBase)
    

    The search base for group membership searches. Defaults to "". Parameters: groupSearchBase - Returns: the LdapAuthenticationProviderConfigurer for further customizations

    所以group-search-base是查找角色信息的基本路径

    public LdapAuthenticationProviderConfigurer<B> groupSearchFilter(String groupSearchFilter)
    

    The LDAP filter to search for groups. Defaults to "(uniqueMember={0})". The substituted parameter is the DN of the user. Parameters: groupSearchFilter - the LDAP filter to search for groups Returns: the LdapAuthenticationProviderConfigurer for further customizations

    所以group-search-filter是包含用户完整dn(可分辨名称)的属性名