如何在ApacheDS中configurationLDAP以使用uid进行身份validation?

当使用Apache Directory Studio在dc=example,dc=com下添加一个新用户时,我有这个树结构:

 dc=example,dc=com |-- ou = engineering |-- cn = Lawrence KH Loh+o=IKEA+sn=Loh+uid=lawrence+displayName=Lawrence 

以下是cn的属性列表。

  1. objectClass = inetOrgPerson
  2. objectClass = organizationalPerson
  3. objectClass = person
  4. objectClass = top
  5. cn = Lawrence KH Loh
  6. sn = Loh
  7. displayName =劳伦斯
  8. o =宜家
  9. uid =劳伦斯
  10. userPassword = SSHA散列密码

有这个错误LDAP: error code 49 - INVALID_CREDENTIALS: Bind failed: Attempt to lookup non-existant entry通过uid=lawrence,ou=engineering,dc=example,dc=com连接此条LDAP: error code 49 - INVALID_CREDENTIALS: Bind failed: Attempt to lookup non-existant entryLDAP: error code 49 - INVALID_CREDENTIALS: Bind failed: Attempt to lookup non-existant entry 。 但是,如果我使用这个工作正常,那么cn=Lawrence KH Loh+o=IKEA+sn=Loh+uid=lawrence+displayName=Lawrence,ou=engineering,dc=example,dc=com 。 我可以知道如何切换到uid=lawrence而不是长名称进行身份validation?

有了这个特定的对象,这是不可能的。 LDAP正在寻找您与对象的可分辨名称 (DN)绑定,并且此情况下的主属性是cn 。 这是一个深思熟虑的devise决定,因为不能保证容器内的对象的任何给定的属性将是唯一的,而不是与它们的DN相关联的属性。

这不会阻止服务能够search您的目录,并确定uid=lawrence与该特定的DN相关联(从而能够find任何需要该对象的其他属性),但是明确需要运行的任何调用针对DN只能针对主要属性运行。

这并不是说没有办法可以避免指定一个DN。 想到实现SASLauthentication和定义SASL ID和DN之间的映射。 但是,在您的问题的上下文中,否,您不能切换到使用您正在进行身份validation的DN的非主要属性来代替DN。