![]() |
iPlanet Directory Server 5.1 管理员指南 |
附录 C LDAP URL
一种表示 LDAP 查询的方法,该方法使用 URL 指定目录服务器主机和搜索的 DN 或过滤器。iPlanet Directory Server 将响应以 LDAP URL 方式发送的查询,并返回一个 HTML 页面说明查询结果。在允许匿名搜索的情况下,该方法可以让 web 浏览器执行目录搜索。
管理 iPlanet Directory Server 引荐或访问控制指令时,也可以使用 LDAP URL 来指定目标项。
LDAP URL 的组件
LDAP URL 的组件
LDAP URL 的语法如下所示:
ldap[s]://hostname:port/base_dn?attributes?scope?filter
其中 ldap:// 协议用于通过非安全连接来连接 LDAP 服务器,而 ldaps:// 协议则用于通过 SSL 连接来连接 LDAP 服务器。表 C-1 列出 LDAP URL 的组件。
组件
说明 hostname
port
base_dn
attributes
scope
filter
属性、范围和过滤器组件分别由它们在 URL 中的位置进行标识。如果不想指定任何属性,您仍需要使用问号来分隔界定该字段。
例如,要指定从 "dc=siroe,dc=com" 开始、返回匹配 "(sn=Jensen)" 之条目所有属性的子树搜索,请使用下列 LDAP URL:
ldap://ldap.siroe.com/dc=siroe,dc=com??sub?(sn=Jensen)
两个连续的问号 ?? 指示未指定属性。由于 URL 中未指定具体的属性,因此将返回搜索到的所有属性。
对非安全字符进行转义
URL 中的所有“非安全”字符都需要用特定的字符序列来表示。该过程称为“非安全字符的转义”。
例如,空格就是一个非安全字符,在 URL 必须表示为 %20。这样,特异名称 "o=siroe.com corporation" 必须编码为 "o=siroe.com%20corporation"。
下表列出在 URL 中被视为非安全的字符,同时提供用于替代非安全字符的相关转义字符。
下列 LDAP URL 指定对带有特异名称 dc=siroe,dc=com 的条目执行基本搜索。
ldap://ldap.siroe.com/dc=siroe,dc=com
由于未指定端口号,因此将使用标准 LDAP 端口号 (389)。
由于未指定搜索范围,因此搜索过程将被限定在基本条目 dc=siroe,dc=com 上。
由于未指定过滤器,因此目录将使用默认过滤器 (objectclass=*)。
下列 LDAP URL 将检索带有特异名称 dc=siroe,dc=com 的条目的 postalAddress 属性。
ldap://ldap.siroe.com/dc=siroe,dc=com?postalAddress
下列 LDAP URL 将检索 Barbara Jensen 条目的 cn、mail 和 telephoneNumber 属性:
ldap://ldap.siroe.com/cn=Barbara%20Jensen,dc=siroe,dc=com?cn,mail,telephoneNumber
由于未指定搜索范围,因此搜索过程将被限定在基本条目 cn=Barbara Jensen,dc=siroe,dc=com 上。
由于未指定过滤器,因此目录将使用默认过滤器 (objectclass=*)。
下列 LDAP URL 指定搜索姓氏为 Jensen,且位于 dc=siroe,dc=com 下属某一级的条目:
ldap://ldap.siroe.com/dc=siroe,dc=com??sub?(sn=Jensen)
下列 LDAP URL 指定搜索 dc=siroe,dc=com 下一级上所有条目的对象类:
ldap://ldap.siroe.com/dc=siroe,dc=com?objectClass?one
上一页 目录 索引 文档主页 下一页
版权所有 © 2001 Sun Microsystems, Inc.。部分版权所有 © 2001 Netscape Communications Corp.。保留所有权利。
最近更新时间 2002 年 2 月 15 日