小编Luc*_*lis的帖子

通过 Active Directory LDAP 使用 Spring-Security 进行身份验证

我无法使用真实的活动目录进行身份验证,让我更好地解释一下我尝试使用 spring.io 提出的示例进行身份验证,没有问题,内部服务启动没有任何问题。参考https://spring.io/guides/gs/authenticating-ldap/

我试图通过插入我的活动目录的配置来修改下面的代码,但没有成功。您能否指导我或向我展示一个真实的案例,在不使用示例中的内部服务的情况下建立真正的连接?我在网上查看,但发现一切都与官方示例相似,没有任何实际案例

@Override
    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 LdapShaPasswordEncoder())
                    .passwordAttribute("userPassword");
    }
Run Code Online (Sandbox Code Playgroud)

错误显示:LDAP处理过程中出现未分类异常;嵌套异常是 javax.naming.NamingException: [LDAP: error code 1 - 000004DC: LdapErr: DSID-0C0907C2, comment: 为了执行此操作,必须在连接上完成成功的绑定。, data 0, v2580

spring ldap active-directory spring-security spring-ldap

0
推荐指数
1
解决办法
4961
查看次数