You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Franco Andrao <fr...@gruppo4.com> on 2005/06/13 11:31:36 UTC

Authentication-fw and MySql

Hi,
again me with my authentication problem.
I really don't understand how to authenticate using MySql. The code  
I'm using appears to be logical and shared with others I found in the  
mailing list archive but it doesn't work.
Here the codes:

### sitemap

<handler name="demohandler">
     <redirect-to uri="cocoon:/login"/>
     <authentication uri="cocoon:raw:/authenticate"/>
</handler>

<map:match pattern="do-login">
     <map:act type="auth-login">
           <map:parameter name="handler" value="demohandler"/>
           <map:parameter name="parameter_ut_login" value="{request- 
param:username}"/>
           <map:redirect-to uri="protected"/>
     </map:act>
     <map:redirect-to uri="login"/>
</map:match>

<map:pipeline internal-only="true">
       <map:match pattern="authenticate">
         <map:generate src="docs/userlist.xml"/>
         <map:transform type="sql">
             <map:parameter name="use-connection" value="mdgDB"/>
             <map:parameter name="show-nr-of-rows" value="true"/>
             <map:parameter name="clob-encoding" value="UTF-8"/>
             <map:parameter name="parameter_ut_login" value="{request- 
param:parameter_ut_login}"/>
             <map:parameter name="use-request-parameters" value="true"/>
        </map:transform>
        <map:transform src="stylesheets/authenticate.xsl">
            <map:parameter name="use-request-parameters" value="true"/>
        </map:transform>
        <map:serialize type="xml"/>
      </map:match>
</map:pipeline>


### userlist.xml

<authenticate xmlns="http://apache.org/cocoon/SQL/2.0">
<sql:execute-query>
      <sql:query name="authenticate">
           SELECT ut_login from dbutenti
           WHERE
           ut_login='<sql:substitute-value  
sql:name="parameter_ut_login"/>'
      </sql:query>
     </sql:execute-query>
</authenticate>


### authenticate.xsl

<xsl:stylesheet version="1.0"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                 xmlns:sql="http://apache.org/cocoon/SQL/2.0">

     <xsl:template match="authenticate">
                 <authentication>
                         <xsl:if test="sql:rowset[@sql:nrofrows = 1]">
                                 <ID><xsl:value-of select="sql:rowset/ 
sql:row/sql:ut_login"/></ID>
                         </xsl:iff>
                 </authentication>
     </xsl:template>
</xsl:stylesheet>

Do someone help a confused cocoon new user to understand what's wrong  
in these codes??
Thanks




  

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