InMemory LDAP服务器的凭据无效

时间:2019-09-06 19:13:22

标签: scala ldap unboundid-ldap-sdk

我正在尝试对this scala API进行集成测试。我发现它使用UnboundID

这是我的设置方法。

val config = new InMemoryDirectoryServerConfig("dc=denver,dc=oracle,dc=com")
    config.setSchema(null)
    config.addAdditionalBindCredentials("cn=Manager", "password")

    val ds = new InMemoryDirectoryServer(config)
    val dir = System.getProperty("user.dir") + "\\src\\test\\resources\\test-data.ldif"
    ds.importFromLDIF(true, dir)

现在当我这样做

val ldap = new Ldap(new Settings(ConfigFactory.parseString(s"""ldap{
                                                        host = "ldap://localhost:10389"
                                                        base-dn = "dc=denver,dc=oracle,dc=com"
                                                        bind-dn = "cn=Manager,dc=denver,dc=oracle,dc=com"
                                                        bind-password = "password"}""")))

我得到了'INVALID_CREDENTIALS: Bind failed: ERR_268 Cannot find a partition for cn=Manager,dc=denver,dc=oracle,dc=com'

我如何设置凭证?我尝试了此config.addAdditionalBindCredentials("cn=Manager", "password"),但似乎不起作用。 ldif文件的条目如下:

dc: dc=denver,dc=oracle,dc=com

dn: cn=users,dc=denver,dc=oracle,dc=com
objectclass: container
objectclass: top
cn: users

dn: cn=groups,dc=denver,dc=oracle,dc=com
objectclass: top
objectclass: container
cn: groups

dn: uid=wpsadmin,cn=users,dc=denver,dc=oracle,dc=com
objectclass: organizationalPerson
objectclass: person
objectclass: top
objectclass: inetOrgPerson
uid: wpsadmin
userpassword: wpsadmin
sn: admin
givenName: wps
cn: wps admin

0 个答案:

没有答案