【问题标题】:How do curly brackets in Spring Security Ldap Authentication Filter work?Spring Security Ldap Authentication Filter 中的大括号如何工作?
【发布时间】:2021-11-05 03:16:25
【问题描述】:

当我研究使用 Spring Security 实现 LDAP 身份验证时,我看到组搜索和用户搜索过滤器通常使用 {0} 实现。如:

  public void configure(AuthenticationManagerBuilder auth) throws Exception {
    auth
      .ldapAuthentication()
        .userDnPatterns("uid={0},ou=people")
        .groupSearchBase("ou=groups")
        .contextSource()
          .url("ldap://localhost:8389/dc=springframework,dc=org")
          .and()
        .passwordCompare()
          .passwordEncoder(new BCryptPasswordEncoder())
          .passwordAttribute("userPassword");
  }

In a site,我看到那是用来表示“相等”的标记。但是,这不是很清楚,我在正式文档中找不到关于此的信息。

这些花括号真正突出的是什么,它们可以有任何其他值而不是 0 吗?

【问题讨论】:

    标签: spring authentication spring-security ldap spring-security-ldap


    【解决方案1】:

    我找到了这样一个信息online:大括号之间的值是占位符,可以是0或1。

    {0} 包含带有整个 ldap 基础的用户名,并且,

    {1} 只包含用户名。

    【讨论】:

      猜你喜欢
      • 2015-12-21
      • 2011-02-01
      • 2014-07-02
      • 2011-04-12
      • 1970-01-01
      • 2011-08-07
      • 1970-01-01
      • 2018-04-15
      • 1970-01-01
      相关资源
      最近更新 更多