Snipplets about how to use the LDAP Transformer

Official Cocoon doc: Cocoon LDAP Transformer

Getting the Transformer

The LDAP Tranformer is not included in Cocoon 2.0.3/4 binary version. You have to build your own Version of Cocoon with LDAP Transformer from the sources. How this can be done can be found on http://xml.apache.org/cocoon/installing/index.html.

Sitemap Code Snipplets

Components configuration:

      <map:transformers>
         <map:transformer name="ldap" 
           src="org.apache.cocoon.transformation.LDAPTransformer"/>
      </map:transformers>

Little example pipeline:

         <map:match pattern="doldapqry">
            <map:generate src="LdapQry.xml" />
            <map:transform type="ldap" />
            <map:serialize type="xml" /> 
         </map:match>

Example Query File (check against the documented DTD)

(get all persons with a telephonenumber )

<?xml version="1.0" encoding="ISO-8859-1"?>
<LDAPUSER xmlns:ldap="http://apache.org/cocoon/LDAP/1.0">
      <ldap:execute-query>
        
         <ldap:initializer>com.sun.jndi.ldap.LdapCtxFactory</ldap:initializer>

         <ldap:authentication>simple</ldap:authentication>

         <ldap:version>3</ldap:version>

         <ldap:serverurl>ldap://host.com</ldap:serverurl>

         <ldap:port>389</ldap:port>

         <ldap:scope>SUBTREE_SCOPE</ldap:scope>

         <!--<ldap:scope>ONELEVEL_SCOPE</ldap:scope>-->
         <ldap:searchbase>o=tree</ldap:searchbase>

         <ldap:rootdn>cn=admin,ou=ou,ou=test,o=tree</ldap:rootdn>

         <ldap:password>secretpw</ldap:password>

         <ldap:debug>FALSE</ldap:debug>

         <ldap:deref-link>TRUE</ldap:deref-link>

         <ldap:count-limit>0</ldap:count-limit>

         <ldap:time-limit>0</ldap:time-limit>
        
         <ldap:filter>(&amp;(telephoneNumber=*)(objectClass=person))</ldap:filter>

         <ldap:show-attribute>TRUE</ldap:show-attribute>

         <ldap:doc-element>LDAP</ldap:doc-element>

         <ldap:row-element>LDAPSET</ldap:row-element>

         <ldap:error-element>ELEMENT</ldap:error-element>

         <ldap:attribute>ou</ldap:attribute>
         <ldap:attribute>givenName</ldap:attribute>
         <ldap:attribute>sn</ldap:attribute>
         <ldap:attribute>fullName</ldap:attribute>         
         <ldap:attribute>l</ldap:attribute>
         <ldap:attribute>telephoneNumber</ldap:attribute>

      </ldap:execute-query>
</LDAPUSER>


-- MartinGeissler

Is it okay for you to post the ldap configs and the sample ldif file entry to search? - user

LDAP (last edited 2009-09-20 23:41:25 by localhost)