cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Maxime.Ghey...@swisscom.com>
Subject RE: Antw: FW: LDAP Transformer with XSP page?
Date Thu, 03 Jul 2003 14:24:03 GMT
yes I know this page... My question was if there is a sample of an XSP page. Because I can't
replace values like filter, or rootdn with a requested value from my login page like :

	<xsp:logic>
	     String Mysrv = request.getParameter("serverurl");
	     String Myusr = request.getParameter("name");
	</xsp:logic> 
     
  <authentication>
  <ldap:execute-query> 
    <ldap:initializer>com.sun.jndi.ldap.LdapCtxFactory</ldap:initializer> 
    <ldap:serverurl>ldap://<xsp:expr>Mysrv</xsp:expr></ldap:serverurl>
  
    <ldap:authentification>simple</ldap:authentification> 
    <ldap:rootdn><xsp:expr>Myusr</xsp:expr></ldap:rootdn>
    <ldap:version>3</ldap:version> 
    <ldap:port>389</ldap:port>  
...      

-----Original Message-----
From: Martin Geissler [mailto:M.Geissler@wika.de] 
Sent: Thursday, July 03, 2003 4:17 PM
To: users@cocoon.apache.org; Gheysen Maxime, IT-DTS-ENG-SDM-DAR
Subject: Antw: FW: LDAP Transformer with XSP page?


Hello,
at the snipplets or http://wiki.cocoondev.org/Wiki.jsp?page=LDAP

your xsp has to generate xml code that looks like the example query code.

Example: (hope this helps)
Martin

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsp:page language="java" 
	xmlns:xsp="http://apache.org/xsp" 
	xmlns:xsp-request="http://apache.org/xsp/request/2.0">
   <xsp:structure>
      <xsp:include>java.lang.String</xsp:include>     
   </xsp:structure>
<LDAPSEARCH>
   <xsp:logic>	
	String loopString = null;
	String typeString = null;
	loopString = request.getParameter("loop");
	typeString = request.getParameter("type");
	int loop = 0;

	if (typeString.equals("xml")) 
	{
	  if (loopString != null) 
 	  {
	    loop = Integer.parseInt(loopString);
	    // wenn Loopangabe, mindere Eingabe um 1
	    loop = loop - 1;
	  }
	  else 
	  { 
	    // wenn keine Loopangabe, setze Schleife auf 0 zusätzliche Durchläufe
	    loop = 0;
	  }
	}
	else if (typeString.equals("html"))
	{
	  // wenn HTML; setze Schleife auf 1 zusätzlichen Durchlauf
	  loop = 1;
	}
	else
	{ }

   </xsp:logic>	
   <LOOP><xsp:expr>loop</xsp:expr></LOOP>
   
   <STRING><xsp-request:get-query-string/></STRING>

   <ldap:execute-query xmlns:ldap="http://apache.org/cocoon/LDAP/1.0">
      <ldap:initializer>com.sun.jndi.ldap.LdapCtxFactory</ldap:initializer>

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

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

      <ldap:serverurl>ldap://service1.intra.test.de</ldap:serverurl>

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

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

      <ldap:rootdn>cn=me,ou=IS,o=test</ldap:rootdn>

      <ldap:password>xxxxxxxxxx</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>

      <xsp:logic>

        String search = request.getParameter("search");
            
        if (("cn").equals(search))
        {

      </xsp:logic>

      <ldap:filter>(| <xsp:logic>
        String[] dn; 
        dn = new String[request.getParameterValues("dn").length]; 
        for (int i=0; i&lt;request.getParameterValues("dn").length; i++) 
        { 
          try 
          { 
            dn[i] = new String(request.getParameterValues("dn")[i]); 
            dn[i] = "("+dn[i].substring(0,dn[i].indexOf(","))+")";
            </xsp:logic><xsp:expr>dn[i]</xsp:expr><xsp:logic>
          } 
          catch (IllegalArgumentException _e) 
          {} 
        }

      </xsp:logic> )</ldap:filter>
      
      <xsp:logic>
        }
        else if (("dn").equals(search))
        {
      </xsp:logic>        
      
      <ldap:filter>(| (cn=*))</ldap:filter>
      
      <ldap:searchbase><xsp-request:get-parameter name="dn" default="" /></ldap:searchbase>
      <xsp:logic>
        }
        else 
        {}
      </xsp:logic>
      
      <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>CN</ldap:attribute>

      <ldap:attribute>DN</ldap:attribute>

      <ldap:attribute>OU</ldap:attribute>

      <ldap:attribute>SN</ldap:attribute>

      <ldap:attribute>EMPLOYEEID</ldap:attribute>

      <ldap:attribute>TELEPHONENUMBER</ldap:attribute>

      <ldap:attribute>ASSISTANT</ldap:attribute>

      <ldap:attribute>MANAGER</ldap:attribute>
      
      <ldap:attribute>DIRECTREPORTS</ldap:attribute>

      <ldap:attribute>ORGCHARTPARENTDN</ldap:attribute>

      <ldap:attribute>FULLNAME</ldap:attribute>

      <ldap:attribute>GIVENNAME</ldap:attribute>

   </ldap:execute-query>
</LDAPSEARCH>
</xsp:page>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message