使用Spring Boot和LDAP进行身份验证

时间:2019-12-03 14:30:01

标签: java spring-boot authentication ldap

我试图让我的Spring Boot App连接到在这里找到的ldap服务器: forumsys.com

在扩展WebSecurityConfigurerAdapter的WebSecurityConfig类文件中,我具有以下内容:

@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
    if(authType.trim().equals("ldap")) {
        auth
                .ldapAuthentication()
                .contextSource()
                .url("ldap://ldap.forumsys.com:389/dc=example,dc=com")
                .and()
                .userDnPatterns("uid={0},ou=mathematicians,dc=example,dc=com");

我正在尝试使用用户:riemann,密码

现在,当我尝试登录时,我首先仅输入一个用户名并收到此错误: org.springframework.security.authentication.BadCredentialsException:空密码 似乎正确。

现在当我同时尝试使用用户名和密码时,出现错误: org.springframework.security.authentication.BadCredentialsException:错误的凭据

不确定登录失败的原因。我不确定用户是否在该服务器上进行了更改,或者我做错了什么?关于为何使用不良凭据的任何想法?

0 个答案:

没有答案
相关问题