相关疑难解决方法(0)

LDAP:错误代码49 - 80090308:LdapErr:DSID-0C0903A9,注释:AcceptSecurityContext错误,数据52e,v1db1

LDAP:错误代码49 - 80090308:LdapErr:DSID-0C0903A9,注释:AcceptSecurityContext错误,数据52e,v1db1

我知道"52e"代码是用户名有效,但密码无效.我在apache studio中使用相同的用户名和密码,我能够成功建立与LDAP的连接.

这是我的java代码

    String userName = "*******";
    String password = "********";
    String base ="DC=PSLTESTDOMAIN,DC=LOCAL";
    String dn = "cn=" + userName + "," + base;  
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, "ldap://******");
    env.put(Context.SECURITY_AUTHENTICATION, "simple");
    env.put(Context.SECURITY_PRINCIPAL, dn);
    env.put(Context.SECURITY_CREDENTIALS, password);
    LDAPAuthenticationService ldap = new LDAPAuthenticationService();
   // LdapContext ctx;
    DirContext ctx = null;
    try {
        ctx = new InitialDirContext(env);
Run Code Online (Sandbox Code Playgroud)

我的错误是在这一行:ctx = new InitialDirContext(env);

我不知道究竟是什么导致了这个错误.

authentication ldap

51
推荐指数
6
解决办法
26万
查看次数

标签 统计

authentication ×1

ldap ×1