+ ",ou=People,o=SEForge,dc=sei,dc=pku",
LDAPConnection.SCOPE_SUB, "objectClass=*", null, false);
SysUser user = new SysUser();
user.setUserName(uid);
if (!rs.hasMore()) {
throw new EasyJException(
null,
"easyJ.system.service.LDAPService.getUserFromLDAP(String)",
user.getUserName() + "的用户名密码错", "用户名密码错");
}
while (rs.hasMore()) {
LDAPEntry entry = rs.next();
LDAPAttributeSet attSet = entry.getAttributeSet();
Iterator it = attSet.iterator();
while (it.hasNext()) {
LDAPAttribute attr = (LDAPAttribute) it.next();
if (attr.getName().equalsIgnoreCase("userPassword")) {
user.setPassword(attr.getStringValue());
}
}
}
return user;
} catch (LDAPException e) {
// e.printStackTrace();
throw new EasyJException(null,
"easyJ.system.service.LDAPService.getUserFromLDAP(String)",
"验证服务器出错", "验证服务器出错");
} finally {
try {
connection.disconnect();