我正在尝试通过 Spring Boot 应用程序中的安全 adlds 服务器对用户进行身份验证,现在我面临一个问题 2 周,在互联网上没有找到适合我的解决方案。
首先我有一个错误,说我需要在成功操作之前绑定身份验证。我在上下文源中添加了正确的属性,但现在我得到一个错误代码 80,它没有给我任何关于错误的线索。
这是我的代码:
应用程序.yml
spring:
ldap:
url: ldaps://<hostname>:636
base: DC=<dc>>,DC=<dc>
username: CN=<cn>>,OU=Privileged,OU=<ou>,OU=<ou>,OU=<ou>,DC=<dc>,DC=<dc>
password: <secret>
base-environment:
com.sun.jndi.ldap.connect.timeout: 500
management:
health:
ldap:
enabled: false
配置.java
@Bean
@DependsOn("frameworkInstance")
public LdapContextSource contextSource() {
LdapContextSource contextSource = new LdapContextSource();
contextSource.setUrl("ldaps://<hostname>:636");
contextSource.setBase("<base>");
contextSource.setUserDn("CN=<cn>,OU=<ou>>,OU=<ou>>,OU=<ou>>,OU=<ou>,DC=<dc>,DC=<dc>>");
contextSource.setPassword("<secret>");
contextSource.afterPropertiesSet();
return contextSource;
}
@Bean
@DependsOn("frameworkInstance")
public LdapTemplate ldapTemplate() {
return new LdapTemplate(contextSource());
}
我的身份验证过程:
Filter filter = new EqualsFilter("cn", "<cn>");
ldapTemplate.authenticate(LdapUtils.emptyLdapName(), filter.encode(), "<secret>");
错误代码是:
Uncategorized exception occured during LDAP processing; nested exception is javax.naming.NamingException: [LDAP: error code 80 - 80090304: LdapErr: DSID-0C090447, comment: AcceptSecurityContext error, data 20ee, v3839\u0000]
我尝试了几天但没有任何结果......用于“绑定”和身份验证的帐户是相同的,以确保身份验证成功。请记住,由于生产环境,V形之间的单词是隐藏的,我不允许显示凭据等。
请问您有解决该问题的任何线索吗?这非常关键
此致,