You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by 32...@gmail.com on 2006/07/24 16:39:51 UTC

Problems with authentication fw

Hi,
I am trying to modify the auth-fw sample, but with username & password.

the relevants parts:

login.xml:
<form target="do-login" method="post">
     <input type="text" name="username"/>
     <input type="text" name="password"/>
     <input type="submit">Login</input>
 </form>


userlist.xml:
<user>
            <name>cocoon</name>
            <pw>test</pw>
 </user>


authenticate.xsl:
<xsl:param name="name"/>
<xsl:param name="pw"/>
.
.
.
<xsl:template match="user">
    <!-- Compare the name of the user -->
    <xsl:if test="normalize-space(name) = $name" and "normalize-space(pw) =
$pw">
        <!-- found, so create the ID -->
        <ID><xsl:value-of select="name"/></ID>
    </xsl:if>
</xsl:template>

sitemap:
<map:match pattern="do-login">
        <!-- try to login -->
        <map:act type="auth-login">
          <map:parameter name="handler" value="demohandler"/>
          <map:parameter name="parameter_name"
value="{request-param:username}"/>
          <map:parameter name="parameter_pw"
value="{request-param:password}"/>
          <map:redirect-to uri="protected"/>
        </map:act>
        <!-- something was wrong, try it again -->
        <map:redirect-to uri="login"/>
      </map:match>

But that does not work. Where is my mistake ?

Thanks for helping
Marco

Re: Problems with authentication fw

Posted by 32...@gmail.com.
I found the mistake mysqlf, it was in the authenticate.xsl:
<xsl:template match="user">
    <!-- Compare the name of the user -->
    <xsl:if test="normalize-space(name) = $name" >
    <xsl:if test="normalize-space(pw) = $pw">
        <!-- found, so create the ID -->
        <ID><xsl:value-of select="name"/></ID>
    </xsl:if></xsl:if>
</xsl:template>



2006/7/24, 321los@gmail.com <32...@gmail.com>:
>
> Hi,
> I am trying to modify the auth-fw sample, but with username & password.
>
> the relevants parts:
>
> login.xml:
> <form target="do-login" method="post">
>      <input type="text" name="username"/>
>      <input type="text" name="password"/>
>      <input type="submit">Login</input>
>  </form>
>
>
> userlist.xml:
> <user>
>             <name>cocoon</name>
>             <pw>test</pw>
>  </user>
>
>
> authenticate.xsl:
> <xsl:param name="name"/>
> <xsl:param name="pw"/>
> .
> .
> .
> <xsl:template match="user">
>     <!-- Compare the name of the user -->
>     <xsl:if test="normalize-space(name) = $name" and "normalize-space(pw)
> = $pw">
>         <!-- found, so create the ID -->
>         <ID><xsl:value-of select="name"/></ID>
>     </xsl:if>
> </xsl:template>
>
> sitemap:
> <map:match pattern="do-login">
>         <!-- try to login -->
>         <map:act type="auth-login">
>           <map:parameter name="handler" value="demohandler"/>
>           <map:parameter name="parameter_name"
> value="{request-param:username}"/>
>           <map:parameter name="parameter_pw"
> value="{request-param:password}"/>
>           <map:redirect-to uri="protected"/>
>         </map:act>
>         <!-- something was wrong, try it again -->
>         <map:redirect-to uri="login"/>
>       </map:match>
>
> But that does not work. Where is my mistake ?
>
> Thanks for helping
> Marco
>