Ldap与ssl-WebSecurityConfig-java
我正在尝试在我的应用程序中使用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,它停止工作…)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:握手期间远程主机关闭连接]
@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");
}
}