【问题标题】:Groovy LDAP search requestGroovy LDAP 搜索请求
【发布时间】:2014-06-12 20:29:59
【问题描述】:

我正在尝试在我们的 Grails 应用程序中实现 Groovy LDAP (http://directory.apache.org/api/groovy-ldap.html)。

我的代码是

    def ldap = new LDAP('ldap://server:389/dc=organization,dc=com', 'cn=Administrator,cn=users,dc=organization,dc=com', 'password')

    def results = ldap.search('(objectClass=*)', 'dc=organization,dc=com', SearchScope.ONE )
    println " ${results.size} entries found ".center(40,'-')
    for (entry in results) {
        println entry.dn
    }

因此,我总是遇到以下异常:

ERROR errors.GrailsExceptionResolver  - NameNotFoundException occurred when processing request: [GET] /app/directory/index
[LDAP: error code 32 - 0000208D: NameErr: DSID-03100213, problem 2001 (NO_OBJECT), data 0, best match of:
'DC=organization,DC=com'
]. 

如果我使用文档中的读取操作也会发生同样的情况

ldap.read('cn=Administrator,cn=users,dc=organization,dc=com'')

我该如何解决这个问题?

【问题讨论】:

  • 2019年找这个库:@Grapes( @Grab(group='org.xbib.groovy', module='groovy-ldap', version='1.0.2') )

标签: grails groovy active-directory


【解决方案1】:

您在服务器 url (ldap://server:389/dc=organization,dc=com) 中指定了基本 DN,因此您可能应该在没有 dc=organization,dc=com 的情况下搜索/阅读。尝试:

ldap.read('cn=Administrator,cn=users')

【讨论】:

    猜你喜欢
    • 2011-08-22
    • 1970-01-01
    • 1970-01-01
    • 2020-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-17
    • 1970-01-01
    相关资源
    最近更新 更多