package com.abc;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
import javax.naming.ldap.InitialLdapContext;
import javax.naming.ldap.LdapContext;
public class test2 {
public static void main(String args[]) {
Hashtable<String, String> HashEnv = new Hashtable<String, String>();
String baseName = ",cn=users,dc=abc,dc=com";
String LDAP_URL = "ldap://10.254.xxx.xxx:389"; //LDAP访问地址
String adminName = "cn=administrator" + baseName; //注意用户名的写法
String adminPassword = "abc123"; //密码
HashEnv.put(Context.SECURITY_AUTHENTICATION, "simple"); //LDAP访问安全级别
Ha
java连接微软AD(LDAP)
最新推荐文章于 2023-06-06 12:25:16 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)