在 Java 中获取 LDAP 架构
我正在尝试获取 LDAP 实体的架构。有人建议我使用 Novell 的开源 LDAP 库,这似乎相当不错。我找到了一个名为 GetAttributeSchema 的示例,听起来确实不错,但是我认为我的参数设置不正确或其他什么。
我得到的结果是:
ou ( 2.5.4.11 NAME ( 'ou' 'organizationalUnitName' ) DESC 'Standard LDAP attribute type' SUP 'name' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
objectClass ( 2.5.4.0 NAME 'objectClass' DESC 'Standard LDAP attribute type' EQUALITY 'objectIdentifierMatch' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256 (XXX: syntax should be ...38)' )
我期望的结果是 [某种效果]:
cn
affiliations
streetaddress
phone
fax
etc
只是想知道 LDAP 专家是否清楚我缺少什么或我应该要求什么。
谢谢!
================================
解决方案:
ServiceableLDAPConnection lc = takeConnection();
LDAPSchema schema = lc.fetchSchema(lc.getSchemaDN());
Enumeration<?> enumeration = schema.getAttributeNames();
我发现这个网站特别有用:http://www.go4expert.com/forums/showthread.php?t=4814
======= =======================
I'm trying to fetch the schema of an LDAP entity. I've been advised to use Novell's open sourced LDAP library, which seems to be quite good. I found an example called GetAttributeSchema, which sounds really good, but I think I've got a parameter set incorrectly or something.
The results I'm getting are:
ou ( 2.5.4.11 NAME ( 'ou' 'organizationalUnitName' ) DESC 'Standard LDAP attribute type' SUP 'name' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256' )
objectClass ( 2.5.4.0 NAME 'objectClass' DESC 'Standard LDAP attribute type' EQUALITY 'objectIdentifierMatch' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'RFC 2256 (XXX: syntax should be ...38)' )
The results I'm expecting are [something to the effect of]:
cn
affiliations
streetaddress
phone
fax
etc
Just wondering if it's obvious to an LDAP expert what I'm missing or what I should be asking for.
Thanks!
==============================
SOLUTION:
ServiceableLDAPConnection lc = takeConnection();
LDAPSchema schema = lc.fetchSchema(lc.getSchemaDN());
Enumeration<?> enumeration = schema.getAttributeNames();
I found this site particularly useful: http://www.go4expert.com/forums/showthread.php?t=4814
==============================
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将获得完整的架构定义。通常,在 LDAP 查询 cn=schema 中,您会将整个模式作为需要解析的一个对象来获取。
You are getting the full schema definitions. Usually in LDAP queries for cn=schema, you get the entire schema as one object you will need to parse.