📄 ldaptest.java
字号:
import com.novell.ldap.LDAPConnection;
import com.novell.ldap.LDAPEntry;
import com.novell.ldap.LDAPSearchResults;
public class LdapTest {
/**
* @param args
*/
@SuppressWarnings("deprecation")
public static void main(String[] args) {
// TODO Auto-generated method stub
String host="192.168.2.236";
int port=389;
LDAPConnection lc = new LDAPConnection();
try{
lc.connect(host, port);
//lc.bind("CN=Administrator,CN=Users,DC=hotelvm,DC=com", "password.com".getBytes());
lc.bind(LDAPConnection.LDAP_V3,"cn=administrator,cn=users,DC=hotelvm,DC=spotlight,DC=com", "password.com");
LDAPSearchResults rs = lc.search("OU=WorkFlowUser,DC=hotelvm,DC=com",LDAPConnection.SCOPE_SUB,"objectClass=*",null,false);
int count = 0;
while(rs.hasMore()){
LDAPEntry entry = rs.next();
System.out.println(entry.getDN());
count++;
}
}catch(Exception e){
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -