我可以配置为始终从多值 LDAP 属性中获取第二个 `cn` 值吗?

Can I configure always to take second `cn` value from multi-valued LDAP attribute?

LDAP 可以包含多值属性。例如,cn 可以是多值属性。请参阅下面的 LDAP RFC。

我的应用程序只能处理(显示)一个 cn 值。 LDAP 中的所有条目是否都具有相同数量的 cn 属性?

我可以配置为始终取第二个 cn 值吗? 在 LDAP 中处理多值属性的最佳实践是什么?

https://www.rfc-editor.org/rfc/rfc4519#section-2.3

   The 'cn' ('commonName' in X.500) attribute type contains names of an
   object.  Each name is one value of this multi-valued attribute.  If
   the object corresponds to a person, it is typically the person's full
   name.

Will all entries in LDAP have same number of cn attributes?

没有。好吧,除非他们特别添加。

顺便说一句:一些 LDAP 服务器实现不支持 cn 的多个值。 Microsoft Active Directory 就是其中之一

Can I configure always to take second cn value?

没有。 return 属性顺序未在 RFC 规范中定义,因此未知。一些特定的 LDAP 服务器实现以特定顺序执行 return 多值属性。 (比如 FIFO 或 LIFO。

What is a best practice to process multi-valued attributes in LDAP?

不能说我听说过最佳实践。我猜这取决于您要执行的任务。