我正在尝试使 Spring Security 遵循 Active Directory 的推荐。所有配置似乎都可以正常工作,我将dc=example,dc=local其用作基础
但是当尝试登录到引用的用户时,它似乎添加了两倍的基础:
o.s.s.l.a.BindAuthenticator : Attempting to bind as cn=Euro Dude,cn=Users,dc=eu,dc=example,dc=local,dc=example,dc=local
它显然失败了,因为它找不到用户。如果,用调试器阻塞,我删除dc=example,dc=local它登录的额外内容。
看代码
我看到它正在将基本 LDAP 路径附加到专有名称
DistinguishedName userDn = new DistinguishedName(userDnStr);
DistinguishedName fullDn = new DistinguishedName(userDn);
fullDn.prepend(ctxSource.getBaseLdapPath());`
阅读我发现的文档 https://docs.oracle.com/javase/jndi/tutorial/ldap/referral/jndi.html
Windows Active Directory:因为 Active Directory 不支持 Manage Referral 控件,所以本课中的所有示例都不适用于 Active Directory。
这是否意味着它根本不应该工作?
为什么要将碱基添加到完整的专有名称中?请注意,我没有提供用户 DN,而只是sAMAccountName自动获取 和 DN。
o.s.l.c.support.DefaultDirObjectFactory : Received name 'ldap://eu.example.local:389/CN=Euro%20Dude,CN=Users,DC=eu,DC=example,DC=local' contains protocol delimiter; indicating a referral.Stripping protocol and address info to enable construction of a proper LdapName
o.s.l.c.support.DefaultDirObjectFactory : Resulting name after removal of referral information: 'CN=Euro Dude,CN=Users,DC=eu,DC=example,DC=local'
o.s.s.ldap.SpringSecurityLdapTemplate : Found DN: CN=Euro Dude,CN=Users,DC=eu,DC=example,DC=local
o.s.s.l.a.BindAuthenticator : Attempting to bind as cn=Euro Dude,cn=Users,dc=eu,dc=example,dc=local,dc=example,dc=local
s.s.l.DefaultSpringSecurityContextSource : Removing pooling flag for user cn=Euro Dude,cn=Users,dc=eu,dc=example,dc=local,dc=example,dc=local
o.s.s.l.a.BindAuthenticator : Failed to bind as CN=Euro Dude,CN=Users,DC=eu,DC=example,DC=local: org.springframework.ldap.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C09042F, comment: AcceptSecurityContext error, data 52e, v2580