1 回答
TA贡献1865条经验 获得超7个赞
ctx.getAttributes(username, new String[] {"*", "+"});
用户名 - 根据文档,这应该是 DN 这就是 LDAP 知道您从哪个记录中提取数据的方式
第二个参数,如果设置为null,它将检索所有属性
我相信您的错误被抛出,因为您传递的是用户名而不是专有名称。
/**
* Retrieves selected attributes associated with a named object.
* See {@link #getAttributes(Name, String[])} for details.
*
* @param name
* The name of the object from which to retrieve attributes
* @param attrIds
* the identifiers of the attributes to retrieve.
* null indicates that all attributes should be retrieved;
* an empty array indicates that none should be retrieved.
* @return the requested attributes; never null
*
* @throws NamingException if a naming exception is encountered
*/
public Attributes getAttributes(String name, String[] attrIds)
throws NamingException;
添加回答
举报