【问题标题】:LDAP search filter not workingLDAP 搜索过滤器不起作用
【发布时间】:2016-08-04 15:57:39
【问题描述】:

在我的 spring boot / spring security java 应用程序中,显示的代码可以正常工作...

但现在我只想限制来自 LDAP 中特定子目录的用户。 (mydomain.local/IT/USERS)

如何限制?

我尝试使用 provider.setSearchFilter(xxxx) 并得到了异常

o.s.s.ldap.SpringSecurityLdapTemplate    : Ignoring PartialResultException

Java 代码:-

    @Bean
    public AuthenticationProvider activeDirectoryLdapAuthenticationProvider() {

        ActiveDirectoryLdapAuthenticationProvider provider = new ActiveDirectoryLdapAuthenticationProvider("mydomain.local", "ldap://server.mydomain.local:389");
        provider.setConvertSubErrorCodesToExceptions(true);
        provider.setUseAuthenticationRequestCredentials(true);
    //  provider.setSearchFilter("(sAMAccountName={0})");
        return provider;
    }

【问题讨论】:

    标签: java spring-security active-directory spring-boot ldap


    【解决方案1】:

    您正在设置过滤器,但您没有在任何地方设置 {0} 参数的值。

    【讨论】:

      【解决方案2】:

      它是否适用于:"&(sAMAccountName={0})" 而不是 "(sAMAccountName={0})"

      【讨论】:

      • 不,它不会,因为这不是合法的语法,即使它是合法的也毫无意义,而且问题不是答案。
      • 不礼貌主要在于发表个人言论,并不是我提出的。在这里注意你的举止。
      猜你喜欢
      • 2013-09-24
      • 2018-04-21
      • 1970-01-01
      • 2015-03-12
      • 2018-08-23
      • 2018-11-28
      • 1970-01-01
      • 1970-01-01
      • 2011-01-17
      相关资源
      最近更新 更多