Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/398.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ldap与ssl-WebSecurityConfig-java_Java_Ssl_Spring Boot_Ldap_Spring Security Ldap - Fatal编程技术网

Ldap与ssl-WebSecurityConfig-java

Ldap与ssl-WebSecurityConfig-java,java,ssl,spring-boot,ldap,spring-security-ldap,Java,Ssl,Spring Boot,Ldap,Spring Security Ldap,我正在尝试在我的应用程序中使用Ldap和SSL。我正在使用Appache Directory Studio配置本地连接。我在ADS中测试了连接,并成功建立了通过SSL的连接,但在尝试登录web应用程序时仍有错误: 原因:简单绑定失败:localhost:10636;嵌套异常为javax.naming.CommunicationException:简单绑定失败:localhost:10636[根异常为javax.net.ssl.SSLHandshakeException:握手期间远程主机关闭连接]

我正在尝试在我的应用程序中使用Ldap和SSL。我正在使用Appache Directory Studio配置本地连接。我在ADS中测试了连接,并成功建立了通过SSL的连接,但在尝试登录web应用程序时仍有错误:

原因:简单绑定失败:localhost:10636;嵌套异常为javax.naming.CommunicationException:简单绑定失败:localhost:10636[根异常为javax.net.ssl.SSLHandshakeException:握手期间远程主机关闭连接]

我使用的是具有Spring安全依赖性的Spring boot。 这是我的WebSecurityConfig类(它在没有ssl的情况下运行良好-我将端口更改为ssl,它停止工作…)

@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {


    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(contextSource())
                .passwordCompare()
                    .passwordEncoder(new LdapShaPasswordEncoder())
                    .passwordAttribute("userPassword");
    }

    @Bean
    public DefaultSpringSecurityContextSource contextSource() {
        return  new DefaultSpringSecurityContextSource(Arrays.asList("ldaps://localhost:10636/"), "dc=springframework,dc=org");
    }

}