代码之家  ›  专栏  ›  技术社区  ›  MehdiB

Spring-LDAP身份验证-CRYPT-MD5密码的密码编码器

  •  1
  • MehdiB  · 技术社区  · 6 年前

    我正在尝试在Spring Boot中使用LDAP对用户进行身份验证。这是我的Web安全配置:

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
            .anyRequest().fullyAuthenticated()
            .and()
            .formLogin();
    }
    
    @Override
    public void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.ldapAuthentication()
            .userDnPatterns("uid={0},ou=people")
            .groupSearchBase("ou=groups")
            .contextSource()
            .url("ldap://my.ldap.url/dc=mysite,dc=com")
            .and()
            .passwordCompare()
            .passwordEncoder(new LdapShaPasswordEncoder())
            .passwordAttribute("userPassword");
    }
    

    使用Apache Directory Studio,我可以看到密码加密方法是 CRYPT-MD5 java.lang.NullPointerException: null 尝试登录时出错。 我想我选错了编码器。有人知道我应该用哪个编码器吗?

    0 回复  |  直到 6 年前