Active directory Spring Security LDAP:绑定与ApacheDS中的Active Directory身份验证 什么有效

Active directory Spring Security LDAP:绑定与ApacheDS中的Active Directory身份验证 什么有效,active-directory,apacheds,spring-security-ldap,Active Directory,Apacheds,Spring Security Ldap,我根据我们公司的广告开发了这个: @Bean public AuthenticationProvider adProvider() { ActiveDirectoryLdapAuthenticationProvider adProvider = new ActiveDirectoryLdapAuthenticationProvider( adConfig.getDomain(), adConfig.getUrl(), adConfig.getRootDn());

我根据我们公司的广告开发了这个:

@Bean
public AuthenticationProvider adProvider() {
    ActiveDirectoryLdapAuthenticationProvider adProvider = new ActiveDirectoryLdapAuthenticationProvider(
            adConfig.getDomain(), adConfig.getUrl(), adConfig.getRootDn());

    adProvider.setSearchFilter(adConfig.getSearchFilter());
    adProvider.setUseAuthenticationRequestCredentials(true);
    adProvider.setConvertSubErrorCodesToExceptions(true);
    adProvider.setAuthoritiesMapper(authorities -> List.of(new FooAuthority("*")));

    return adProvider;
}
这确实有效;我可以使用我的公司凭据登录重要信息:我可以使用我的
sAMAccountName
(正好也是我的
uid
)登录

球门 现在我想使用本地广告对某些边缘案例进行一些自动化测试。我选择ApacheDS是因为它具有跨平台的可用性,另外它还有一些Docker容器可用。我使用它,因为它看起来是活动的、有文档记录的和可配置的,对于像我这样的新手来说很重要

问题 问题是,我无法登录。我在
o.s.security.ldap.authentication.ad.activedirectoryldapaauthenticationprovider
中找到了两行代码:而
doAuthentication(…)
中的
searchForUser(ctx,username)
(5.0.12.RELEASE中的第148行)与我的
sAMAccountName
(如foobar)一起工作,
contextFactory.createContext(env)
bindauser(…)
(5.0.12.RELEASE中的第204行)中的
需要一个完全合格的DN(如cn=foobar,ou=people,dc=acme,dc=com)才能工作


所以我似乎有一些误解,可能是因为我的误解。。。似乎我确实需要一些不同的用户进行身份验证,而不是事后搜索?我如何配置它,和/但为什么我们公司的广告工作得很好?PS:我读到匿名认证,也许我们公司允许这样做?但是针对公司的广告使用Apache Directory Studio需要我登录(据我所知).

基于LDAP的简单绑定操作始终需要条目和密码的可分辨名称(DN)。只有AD允许使用samAccountName执行绑定操作。广告有点特别。

谢谢,很高兴知道。你有关于这方面的任何文档的URL吗?我这样问是因为我想研究一下如何配置或如何解决这个问题,需要一些关键字;-)当然,最终的来源将是RFC()。再次感谢。作为将来的参考:
绑定请求定义如下:BindRequest::=[APPLICATION 0]SEQUENCE{version INTEGER(1..127),名称LDAPDN,authentication AuthenticationChoice}