0
的属性我连接到LDAP服务器鲍勃:查看当前连接的LDAP用户
Hashtable props = new Hashtable();
props.put(Context.SECURITY_PRINCIPAL, "cn=Bob,cn=Users,dc=myCompany,dc=com");
props.put(Context.SECURITY_CREDENTIALS, "Password1");
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
props.put(Context.PROVIDER_URL, url);
InitialLdapContext context = new InitialLdapContext(props, null);
现在我想看看Bob的姓名和电子邮件地址。
我期待在context
上找到一个方法来返回当前连接的用户的属性,但我找不到一个。
Bob没有搜索目录的权限,所以连接后我不能使用context.search
。
有没有办法获得这些属性,而无需再次调用LDAP服务器,或者必须先以其他人身份连接?