将身份验证委托给远程LDAP服务器

时间:2019-06-19 23:36:28

标签: spring-security ldap

我正在开发一个网站,为了进行身份验证,我想将其委托给远程LDAP服务器。假设托管LDAP服务器的URL是ldap://ldap.host.co.uk,ou=people、o=co、c=uk,并且在LDAP服务器中保存密码的属性是pass。

我重写WebSecurityConfigurerAdapter的configu()方法的方式如下:

@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
    auth
            .ldapAuthentication()
            .userDnPatterns("uid={0},ou=people,o=co,c=uk")
            .contextSource()
                .url("ldap://ldap.host.co.uk")
                .and()
            .passwordCompare()
                .passwordEncoder(new LdapShaPasswordEncoder())
                .passwordAttribute("pass");
} 

当我运行程序并输入用户名和密码时,需要一分钟然后超时。谁能帮助我了解为什么会这样?

0 个答案:

没有答案