java - LDAP 引用前置库
问题描述
我正在尝试使 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
解决方案
推荐阅读
- azure - 将 Azure Metrics Advisor 与锻炼数据结合使用
- android - 如何添加到 google play 控制台内部测试登台和生产版本?
- ios - 如何仅在 iOS 13.0 之前包含此快速声明
- java - 在 Spring 中具有发送和接收操作的 JMS 事务模型
- kubernetes - Kafka 流本地状态存储持久性与 Kubernetes/OpenShift 上的持久卷
- javascript - 在 useEffect 中获取数据但无法读取未定义的属性“匹配”
- ios - 根据设备大小快速切换背景图像
- c# - Microsoft.TeamFoundation.Build.WebApi.BuildHttpClient UpdateDefinitionAsync - 添加步骤
- r - 数据框每列的累积百分比
- python-3.x - 在 Access 数据库中插入超链接 (pyodbc)