问题描述
有人使用ldapjs进行服务器端排序控制是否成功?文档未提供创建/使用此类控件对象的任何特定示例。
我已经在openldap服务器端启用了覆盖,但似乎无法为客户端控件提供正确的格式。我不确定RFC 2891
中提到的用于创建SortKeyList的Buffer值的正确格式Erics-MBP:Laboration_1 ericjohannesson$ python topmost.py eng_stopwords.txt examples/article.txt 20
bash: topmost.py: command not found
我收到以下错误:
const stringBuf = Buffer.from( 'uid' );
// The LDAP the Server-Side Sorting Control
const controls = new ldap.ldapjs.Control( {
"type": "1.2.840.113556.1.4.473","criticality": true,"value": stringBuf
} );
我已经咨询过function ldapjs.ServerSideSortingRequestControl (options),也没有咨询function ldapjs.Control (options)。
解决方法
我终于从通用的ldapjs.Control切换到了特定的ldapjs.ServerSideSortingRequestControl
您可以仅提供SortKeyList的值。 OID类型将由该函数附加。关键程度可以省略。
const control = { "value": { "attributeType": "uid","orderingRule": "CaseIgnoreOrderingMatch" } };
const controls = new ldap.ldapjs.ServerSideSortingRequestControl( control );
但是请注意,这不是一个非常有效的解决方案