将AD LDS与Java连接

时间:2018-09-05 10:10:46

标签: java ldap adlds

这是我为连接AD LDS而编写的java方法

public static void  test(){
    Hashtable<String, String> ldapEnv = new Hashtable<String, String>(11);
    ldapEnv.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
    ldapEnv.put(Context.PROVIDER_URL,"ldap://10.10.10.10:389/");
    ldapEnv.put(Context.SECURITY_PRINCIPAL,"admin".concat("@").concat("dem"));//admin is the credential to login in the '10.10.10.10' server
    ldapEnv.put(Context.SECURITY_AUTHENTICATION, "simple");
    ldapEnv.put(Context.SECURITY_CREDENTIALS, "password");
    //ldapEnv.put(Context.SECURITY_PROTOCOL, "ssl");
     try {
        new InitialDirContext(ldapEnv);
    } catch (NamingException e) {
        e.printStackTrace();
    }
} 

我正在运行此程序时出现以下错误。请提示错误是什么。

javax.naming.AuthenticationException: [LDAP: error code 49 - 8009030C: LdapErr: DSID-0C09042F, comment: AcceptSecurityContext error, data 2030, v2580

0 个答案:

没有答案