public static DirContext getLDAPConnection() throws NamingException {
String root = "relationName=relation,dc=hisome,dc=com";
String LDAPPassword = "secret";
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://localhost/" + root);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, root);
env.put(Context.SECURITY_CREDENTIALS, LDAPPassword);
DirContext ctx = null;
ctx = new InitialDirContext(env);
return ctx;
}
public static NamingEnumeration<SearchResult> getLDAPResultList(
DirContext ctx) {
NamingEnumeration<SearchResult> enums = null;
try {
String filter = "(objectclass=*)";
SearchControls sh = new SearchControls();
enums = ctx.search("", filter, sh);
if (ctx != null) {
ctx.close();
}
return enums;
} catch (javax.naming.AuthenticationException e) {
e.printStackTrace();
return enums;
} catch (Exception e) {
e.printStackTrace();
return enums;
}
}
一直报NameNotFoundException异常
[LDAP: error code 32 - No Such Object]; remaining name ''
之前参照网上的实例是可以正常拿到SearchResult的,现在我换成自己定义的objectClass就不行了。请问是什么原因呢
问题补充:xihuan&java 写道
把
String filter = "(objectclass=*)";
()去掉试试
去掉了也不行
问题补充:xihuan&java 写道
enums = ctx.search([color=red]""[/color], filter, sh);
这里面还少一个参数
xihuan&java 写道
enums = ctx.search([color=red]""[/color], filter, sh);
这里面还少一个参数
这个参数设置成rootdn或者suffix都不行,我用LdapBrowser可以看到我想要的目录结构和内容
问题补充:xihuan&java 写道
dc=hisome,dc=com
写这个参数也不行吗
是的,不行。SearchControls 设置了级别也不行
问题补充:xihuan&java 写道
objectclass大小写对吗
各种大小写组合都试过,应该不是这个问题
相关推荐
LdapBrowser2.82版,能浏览服务器的ldap数据,还有一份word详细使用文档及ldap安装说明
安装$ npm install --save simple-ldap-search用法import SimpleLDAP from 'simple-ldap-search' ;const config = { url : 'ldap://0.0.0.0:1389' , base : 'dc=users,dc=localhost' , dn : 'cn=root' , password : ...
自己写的 winform
The following is a sample use of highlighting on a search for Corgan in the artist MusicBrainz data set. Recall that the mb_artists request handler is configured to match against the artist name, ...
ldap ubuntu 16.04 离安装包及安装方法
项目中使用spring boot框架集成了ldap协议的方法,调用了增删改查的API,基本实现了spring boot对于ldap的所有方法,只要搭建好了ldap服务器,改一下配置文件即可运行。
LDAP入門,LDAP入門LDAP入門LDAP入門LDAP入門LDAP入門LDAP入門LDAP入門LDAP入門LDAP入門LDAP入門LDAP入門
eLdap-Ldap搜索和过滤器eLdap是一个工具,可以帮助用户在Ldap环境中搜索和过滤查询。 Ldap搜索和过滤器选项已添加。 添加Ldap注入有效负载。 将添加Ldap注射。 Ldap漏洞将被添加。安装git clone ...
资源没有对LDAP创建的内容。 资源主要有: rar包:一个Web工程, 主要有,利用Spring-ldap对LDAP的基本操作(查询,增删改);Extjs实现的对Ldap的树状结构的显示,结构有点类似Softerra LDAP;一个测试类。 pdf:...
Spring LDAP。 官网 Spring LDAP API。 Spring LDAP 开发文档。
LDAP(Lightweight Directory Access Protocol)是一种目录访问协议,允许客户端访问和操作目录服务。 LDAP 广泛应用于企业目录服务中,如 Active Directory、OpenLDAP 等。 Java 使用 LDAP 修改 AD 域用户密码 在...
它是X.500目录访问协议的移植,但是简化了实现方法。本文给大家带来LDAP使用手册,需要的可以来下载看看 LDAP的优点 1:可以存储在其它条件下很难存储的管理信息 2:数据安全可靠,访问控制粒度细腻。 3:LDAP是一个...
LdapBrowser282 ldap浏览器 LdapBrowser 查看openldap的好工具。 使用需要有JDK环境。
java操作ldap类java操作ldap类java操作ldap类
基于RuoYi框架,使用的是ruoyi前后端不分离的版本,实现对LDAP的整合 基于RuoYi框架,使用的是ruoyi前后端不分离的版本,实现对LDAP的整合 基于RuoYi框架,使用的是ruoyi前后端不分离的版本,实现对LDAP的整合 基于...
1 LDAP 基础 LDAP 的英文全称是 Lightweight Directory Access Protocol, 一般都简称为 LDAP。 它是基于 X.500 标准的,但是简单多了并且可以根据需要定制。与 X.500 不同,LDAP 支 持 TCP/IP,这对访问 Internet ...
ldapadmin,windows下管理ldap的工具;ldapadmin,windows下管理ldap的工具
NULL 博文链接:https://dragonlin06.iteye.com/blog/648933
这是一遍比较完整的linux下svn+apche+ldap安装配置手册,根据本人实际安装整理后的文档,目前都算是最新版本。其中ldap使用sun的opends,个人感觉比openldap要方便,当然重点不是用什么ldap而是如何配置。 主要包括...
ldap安装与客户端ldapadmin windows版本,