微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

创建可以验证登录的内存 LDAP 服务器,如域\用户名 unboundid 不起作用

如何解决创建可以验证登录的内存 LDAP 服务器,如域\用户名 unboundid 不起作用

这是一个代码,我正在为其编写端点测试,我需要一个内存中的 LDAP SERVER 来模拟实际的 ldap。因此无法更改 ....... FROM MyTable AS tbl_a OUTER APPLY (SELECT CAST(tbl_a.VarcharMaxColumn AS xml) AS ConvertedXml) AS cast_xml CROSS APPLY cast_xml.ConvertedXml.nodes('/MyProperties/*') AS my_properties_nodes(xml_frag) ....... 中的任何内容

服务器代码

test code

测试代码

InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig("dc=sciencelogic");
            //config.addAdditionalBindCredentials("cn=Directory Manager","password");
            config.setListenerConfigs(InMemoryListenerConfig.createLDAPConfig("default",1389));
            config.setSchema(null);
            InMemoryDirectoryServer ds = new InMemoryDirectoryServer(config);
            ds.startListening();
            ds.importFromLDIF(true,new LDIFReader(getClass().getResourceAsstream("realm.ldif")));

LDIF 文件

authDomainServerIP = "localhost:1389";//oCache.getItemkeyvalue("authenticationDomainServerIP");
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.Security_AUTHENTICATION,"simple");
    env.put(Context.PROVIDER_URL,"ldap://"+authDomainServerIP);

    // The value of Context.Security_PRINCIPAL must be the logon username with the domain name
    env.put(Context.Security_PRINCIPAL,"sciencelogic\\tkrilly");

    // The value of the Context.Security_CREDENTIALS should be the user's password
    env.put(Context.Security_CREDENTIALS,"password");

异常信息

dn: dc=sciencelogic
objectClass: top
objectClass: domain
dc: server


dn: uid=tkrilly,dc=sciencelogic
uid: tkrilly
sAMAccountName: tkrilly
userPrincipalName: tkrilly
cn: Ted Krilly
objectClass: top
objectClass: person
objectClass: inetorgPerson
userPassword: password
street: 100 Commonwealth Avenue
l: Boston
st: MA
postalCode: 02134
mail: tkrilly@company.com
telephoneNumber: 617-776-2661
mobile: 617-776-3000
givenname: Ted
sn: Krilly

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。