如何使用LDAP查找用户对象的属性值?

时间:2016-12-10 22:28:52

标签: ldap openldap spring-ldap ldap-query spring-security-ldap

我是LDAP的新手,目前我对这个话题有疑问。 请帮助我:如何执行ldap搜索以在用户对象“cn = testuser,dc = netmail”上找到“xyz”属性的值?

Given service: ldap, 
host:test.abcd.com,
baseDN:dc=abcd,
baseDN:cn=testuser,dc=abcd,
pass:qaz123.

1 个答案:

答案 0 :(得分:0)

使用while (sc.hasNextLine()) { //read first line from file name = sc.nextLine(); age = sc.nextLine(); gpa = sc.nextLine(); Student newStudent = new Student(name, age, gpa); //deal with age and gpa parsing inside Student constructor students.add(newStudent); System.out.printf("%s %s %s \n", name, age, gpa); //should print the same as System.out.printf("%s %d %f \n", newStudent.name, newStudent.age, newStudent.gpa); } 你可以这样做:

ldapsearch

如果您想使用简单身份验证而不是SASL来进行搜索:

ldapsearch -h test.abcd.com -b cn=testuser,dc=netmail xyz