cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tuan Luu" <tuan...@gmx.ch>
Subject RE: Authentication Framework with Database
Date Sun, 29 Feb 2004 16:01:52 GMT
Ok, at least I have found the solution. The files I have already posted are
just fine, the only thing that needs to be changed was the  parameter name in
the Sitemap. So the part of the sitemap should look like this: 

                        <!-- ========================================= -->
                        <!-- Form target which performs auth service   -->
                        <!-- ========================================= -->
                        <map:match pattern="do-login">
                                <!-- try to login -->
                                <map:act type="auth-login">
                                        <map:parameter name="handler"
value="demohandler"/>
                                        <!-- instead of : <map:parameter
name="parameter_name" value="{request-param:username}"/> do it like this: -->
                                        <map:parameter
name="parameter_username" value="{request-param:username}"/>
                                        <map:parameter
name="parameter_password" value="{request-param:password}"/>
                                        <map:redirect-to uri="protected"/>
                                </map:act>
                                <!-- something was wrong, try it again -->
                                <map:redirect-to uri="login"/>
                        </map:match>


I know how hard it is for a beginner to start, so feel free to contact me if
you need help. I will share the little I know. 
goodbye 


> I wrote a separate pipeline, to test the authentication mechanism. I took
> the authentication fw from the samples directory in cocoon 2.1.2
> 
> I have managed to write the form, retrieve the parameters in an xsp File,
> with esql  query the db and 
> it gives me the correct this result: 
> <?xml version="1.0" encoding="UTF-8" ?> 
>  <authentication>
>  	<ID>user</ID> 
> </authentication>
> 
> But when i use the esql.xsp file and the authentication.xsl in the
> authentication framework, it doesn't work.
> I can't imagine why.  
> In the authenticate.xsl File I have deleted the xsl:if, because when the
> user can't be found, it would give an no records found message, so the
> xsl:if is
> obsolete. 
> 
> Here is the sitemap entry : 
>                 <map:pipeline internal-only="true">
>                         <!-- This is the authentication respource -->
>                         <map:match pattern="authenticate">
>                                 <map:generate type="serverpages"
> src="auth/docs/esql.xsp">
>                                         <map:parameter name="lang"
> value="{1}"/>
>                                         <map:parameter
> name="use-request-parameters" value="true"/>
>                                 </map:generate>
>                                 <map:transform
> src="auth/stylesheets/authenticate.xsl">
>                                         <map:parameter
> name="use-request-parameters" value="true"/>
>                                 </map:transform>
>                                 <map:serialize type="xml"/>
>                         </map:match>
>                 </map:pipeline>
> 
> 
> Here are the Files, I'm using so far: 
> esql.xsp File: 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xsp:page 
>         language="java"
>         xmlns:xsp="http://apache.org/xsp"
>         xmlns:esql="http://apache.org/cocoon/SQL/v2"
>         xmlns:xsp-request="http://apache.org/xsp/request/2.0"
>         >
> 
> <authentication>
>         <xsp:logic>
>            String lang = parameters.getParameter("lang", null);
>         </xsp:logic>
>         <esql:connection>
>         <esql:pool>kt01</esql:pool>
>         <esql:execute-query>
>                 <esql:query>
>                         select * from benutzer 
>                         where username='<xsp-request:get-parameter
> name="username"/>'
>                         and password='<xsp-request:get-parameter
> name="password"/>'
>                 </esql:query>
>                 <esql:results>
>                         <esql:row-results>
>                                 <users><user>
>                                 <name><esql:get-string
> column="username"/></name>
>                                 </user></users>
>                         </esql:row-results>
>                 </esql:results>
>                 <esql:no-results><no-results/></esql:no-results>
>                 <esql:error-results>
>                        
> <error><message><esql:get-message/></message></error>
>                 </esql:error-results>
>         </esql:execute-query>
>         </esql:connection>
> </authentication>
> </xsp:page>
> 
> authenticate.xsl file: 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xsl:stylesheet version="1.0" 
>                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 
> <xsl:template match="authentication">
>   <authentication>
>         <xsl:apply-templates select="users"/>
>   </authentication>
> </xsl:template>
> 
> <xsl:template match="users">
>     <xsl:apply-templates select="user"/>
> </xsl:template>
> 
> <xsl:template match="user">
>         <ID><xsl:value-of select="name"/></ID>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
> 
> I really don't know what else I now can do, to solve this problem. 
> Thanks for your kind help
> 
> 
> -- 
> GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 EUR/Monat...)
> jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ http://www.gmx.net/derspiegel
> +++
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 

-- 
GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 EUR/Monat...)
jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ http://www.gmx.net/derspiegel +++


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


Mime
View raw message