sunlabs.brazil.ldap
Class LDAPTemplate

java.lang.Object
  extended by sunlabs.brazil.template.Template
      extended by sunlabs.brazil.ldap.LDAPTemplate (view source)
All Implemented Interfaces:
TemplateInterface

public class LDAPTemplate
extends Template

The LDAPTemplate is invoked to process LDAP tags embedded in a document. This version requires the "ldap40.jar" file from the Netscape Navigator distribution.

The LDAPTemplate uses the following special tag:

When an LDAP tag is seen, the LDAP database is searched and the results are used to populate the request properties.

The following configuration parameters are used to perform the search. The parameters may appear either in the request properties (preceded by the prefix of this template as specified in the configuration file) or as named arguments in the LDAP tag.

prefix
The string prefix for the property names that will be stored in the request properties to hold the results. If not specified, defaults to the prefix of this template as specified in the configuration file.

dn
The Distinguished Name (DN) to lookup in the LDAP server. The format of a DN is described in RFC-1779. The "dn" and "search" options are mutually exclusive. When "dn" is specified, only zero or one result will be returned from the LDAP database. The result (if any) will be stored in the request properties as follows:
 <ldap dn="uid=6105,ou=people,o=WebAuth" prefix=name>
 <property name.dn>
 <property name.cn>
 <property name.sn>
 <property name.objectclass>
etc. The property name.dn is the DN that was found. Other properties will be defined as shown, based on the attributes present in the LDAP record.

search
The search filter to use when searching the LDAP server. The format of a search filter is described in RFC-1558. The "search" and "dn" options are mutually exclusive. When "search" is specified, zero or more results will be returned from the LDAP database. The results will be stored in the request properties as follows:
 <ldap search="(givenname=scott)" prefix=name>
 <property name.rows>
 <property name.rowcount>
 
 <property name.0.dn>
 <property name.0.cn>
 <property name.0.mail>

 <property name.1.dn>
 <property name.1.cn>
 <property name.1.pager>
etc. The property name.rows is set to the list of record indices found, and can be used by the BSL tag <foreach name=x property=name.rows> to iterate over all records. Other properties will be defined for each of the records found as shown, based on the attributes present in the each of the LDAP records.

base
The Distinguished Name of the base record that forms the root of the search tree in the LDAP database. Used only with the "search" option. Defaults to "". This would be a good option to specify in the configuration file rather than in the LDAP tag.

scope
The scope of the LDAP search, one of Used only with the "search" option. Defaults to "sub". This would be a good option to specify in the configuration file rather than in the LDAP tag.

attributes
The space-delimited list of attribute names to return from the LDAP "dn" or "search" operation. If empty or unspecified, all attributes for the record are returned. Not all records in the LDAP database have the same attributes. Defaults to "".

host
The hostname of the LDAP server, of the form "host" or "host:port" if the server is not running on the standard LDAP port. Defaults to "". This would be a good option to specify in the configuration file rather than in the LDAP tag.

authenticate
The Distinguished Name used for authenticating to the LDAP server, if necessary. Defaults to "". This would be a good option to specify in the configuration file rather than in the LDAP tag.

password
The password sent when the "authenticate" option is used. Defaults to "". If it begins with a '@', The rest of the password is taken as the name of a file containing the password. The password "@-" causes the password to be read from stdin.
limit
The maxumum number of records returned. defaults to 1000.
timeout
The maxumum time to wait for a response, in ms. Defaults to 30000 (30s).


Field Summary
 
Fields inherited from class sunlabs.brazil.template.Template
debug
 
Constructor Summary
LDAPTemplate()
           
 
Method Summary
 void tag_ldap(RewriteContext hr)
          Process <ldap> tags.
 
Methods inherited from class sunlabs.brazil.template.Template
done, init
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDAPTemplate

public LDAPTemplate()
Method Detail

tag_ldap

public void tag_ldap(RewriteContext hr)
Process <ldap> tags.


Version Kenai-svn-r24, Generated 08/18/09
Copyright (c) 2001-2009, Sun Microsystems.