You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "J.D. Williams" <jd...@austin.rr.com> on 2007/01/18 18:00:16 UTC

authentication-fw and sql

I am having a problem using a MySQL database as an authentication
resource with the Authentication Framework. 

This authentication resource pipeline:

      <map:match pattern="authenticate-db">
        <map:generate src="docs/userquery.xml"/>
        

        <map:transform type="sql">
            <map:parameter name="use-connection" value="sandbox"/>
          <map:parameter name="show-nr-of-rows" value="true"/>
          <map:parameter name="use-request-parameters" value="true"/>
          <map:parameter name="username"
value="{request-param:username}"/>
        </map:transform>
         <map:transform src="stylesheets/authenticate-db.xsl">
          <map:parameter name="use-request-parameters" value="true"/>
                     <map:parameter name="username"
value="{request-param:username}"/>
        </map:transform>

        <map:serialize type="xml"/>
      </map:match>

And this XML:

  <authentication>
   	<users>
		<user>
			<name><sql:execute-query
xmlns:sql="http://apache.org/cocoon/SQL/2.0"><sql:query>select username
from sandbox where username='<sql:substitute-value
name="username"/>'</sql:query></sql:execute-query></name>
		</user>
   	</users>
  </authentication>

And this XSL:

<xsl:param name="username"/>
    

<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">
    <!-- Compare the name of the user -->
    <xsl:if test="normalize-space(name)=$username">
        <!-- found, so create the ID -->
        <ID><xsl:value-of select="name"/></ID>
    </xsl:if>
</xsl:template>

I can type the URL into the browser address bar:

http://localhost:8080/review6/authentication-fw-db/authenticate-db?username=JD

And get this XML as a response:

<authentication xmlns:sql="http://apache.org/cocoon/SQL/2.0">
<ID>JD</ID>
</authentication>

However, when trying to use this authentication resource with the login
page, etc., it keeps kicking me back to the login page instead of
returning the protected page.

Clues?


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


Re: authentication-fw and sql

Posted by "J.D. Williams" <jd...@austin.rr.com>.
Found the answer here...

http://mail-archives.apache.org/mod_mbox/cocoon-users/200402.mbox/%
3C25760.1077866384@www51.gmx.net%3E


On Fri, 2007-01-19 at 08:43 -0600, J.D. Williams wrote:
> Still not having any luck with this. I have rebuilt the sitemap several
> times now and made sure that the authentication resource returns the
> proper XML. 
> 
> It does, but fails to return the protected resource when I use the login
> page. I work alone and could really use some help on this.
> 
> Joe
> 
> On Thu, 2007-01-18 at 11:00 -0600, J.D. Williams wrote:
> > I am having a problem using a MySQL database as an authentication
> > resource with the Authentication Framework. 
> > 
> > This authentication resource pipeline:
> > 
> >       <map:match pattern="authenticate-db">
> >         <map:generate src="docs/userquery.xml"/>
> >         
> > 
> >         <map:transform type="sql">
> >             <map:parameter name="use-connection" value="sandbox"/>
> >           <map:parameter name="show-nr-of-rows" value="true"/>
> >           <map:parameter name="use-request-parameters" value="true"/>
> >           <map:parameter name="username"
> > value="{request-param:username}"/>
> >         </map:transform>
> >          <map:transform src="stylesheets/authenticate-db.xsl">
> >           <map:parameter name="use-request-parameters" value="true"/>
> >                      <map:parameter name="username"
> > value="{request-param:username}"/>
> >         </map:transform>
> > 
> >         <map:serialize type="xml"/>
> >       </map:match>
> > 
> > And this XML:
> > 
> >   <authentication>
> >    	<users>
> > 		<user>
> > 			<name><sql:execute-query
> > xmlns:sql="http://apache.org/cocoon/SQL/2.0"><sql:query>select username
> > from sandbox where username='<sql:substitute-value
> > name="username"/>'</sql:query></sql:execute-query></name>
> > 		</user>
> >    	</users>
> >   </authentication>
> > 
> > And this XSL:
> > 
> > <xsl:param name="username"/>
> >     
> > 
> > <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">
> >     <!-- Compare the name of the user -->
> >     <xsl:if test="normalize-space(name)=$username">
> >         <!-- found, so create the ID -->
> >         <ID><xsl:value-of select="name"/></ID>
> >     </xsl:if>
> > </xsl:template>
> > 
> > I can type the URL into the browser address bar:
> > 
> > http://localhost:8080/review6/authentication-fw-db/authenticate-db?username=JD
> > 
> > And get this XML as a response:
> > 
> > <authentication xmlns:sql="http://apache.org/cocoon/SQL/2.0">
> > <ID>JD</ID>
> > </authentication>
> > 
> > However, when trying to use this authentication resource with the login
> > page, etc., it keeps kicking me back to the login page instead of
> > returning the protected page.
> > 
> > Clues?
> > 
> > 
> > ---------------------------------------------------------------------
> > 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


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


Re: authentication-fw and sql

Posted by "J.D. Williams" <jd...@austin.rr.com>.
Still not having any luck with this. I have rebuilt the sitemap several
times now and made sure that the authentication resource returns the
proper XML. 

It does, but fails to return the protected resource when I use the login
page. I work alone and could really use some help on this.

Joe

On Thu, 2007-01-18 at 11:00 -0600, J.D. Williams wrote:
> I am having a problem using a MySQL database as an authentication
> resource with the Authentication Framework. 
> 
> This authentication resource pipeline:
> 
>       <map:match pattern="authenticate-db">
>         <map:generate src="docs/userquery.xml"/>
>         
> 
>         <map:transform type="sql">
>             <map:parameter name="use-connection" value="sandbox"/>
>           <map:parameter name="show-nr-of-rows" value="true"/>
>           <map:parameter name="use-request-parameters" value="true"/>
>           <map:parameter name="username"
> value="{request-param:username}"/>
>         </map:transform>
>          <map:transform src="stylesheets/authenticate-db.xsl">
>           <map:parameter name="use-request-parameters" value="true"/>
>                      <map:parameter name="username"
> value="{request-param:username}"/>
>         </map:transform>
> 
>         <map:serialize type="xml"/>
>       </map:match>
> 
> And this XML:
> 
>   <authentication>
>    	<users>
> 		<user>
> 			<name><sql:execute-query
> xmlns:sql="http://apache.org/cocoon/SQL/2.0"><sql:query>select username
> from sandbox where username='<sql:substitute-value
> name="username"/>'</sql:query></sql:execute-query></name>
> 		</user>
>    	</users>
>   </authentication>
> 
> And this XSL:
> 
> <xsl:param name="username"/>
>     
> 
> <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">
>     <!-- Compare the name of the user -->
>     <xsl:if test="normalize-space(name)=$username">
>         <!-- found, so create the ID -->
>         <ID><xsl:value-of select="name"/></ID>
>     </xsl:if>
> </xsl:template>
> 
> I can type the URL into the browser address bar:
> 
> http://localhost:8080/review6/authentication-fw-db/authenticate-db?username=JD
> 
> And get this XML as a response:
> 
> <authentication xmlns:sql="http://apache.org/cocoon/SQL/2.0">
> <ID>JD</ID>
> </authentication>
> 
> However, when trying to use this authentication resource with the login
> page, etc., it keeps kicking me back to the login page instead of
> returning the protected page.
> 
> Clues?
> 
> 
> ---------------------------------------------------------------------
> 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


Re: authentication-fw and sql

Posted by "J.D. Williams" <jd...@austin.rr.com>.
Tomorrow?

On Thu, 2007-01-18 at 11:00 -0600, J.D. Williams wrote:
> I am having a problem using a MySQL database as an authentication
> resource with the Authentication Framework. 
> 
> This authentication resource pipeline:
> 
>       <map:match pattern="authenticate-db">
>         <map:generate src="docs/userquery.xml"/>
>         
> 
>         <map:transform type="sql">
>             <map:parameter name="use-connection" value="sandbox"/>
>           <map:parameter name="show-nr-of-rows" value="true"/>
>           <map:parameter name="use-request-parameters" value="true"/>
>           <map:parameter name="username"
> value="{request-param:username}"/>
>         </map:transform>
>          <map:transform src="stylesheets/authenticate-db.xsl">
>           <map:parameter name="use-request-parameters" value="true"/>
>                      <map:parameter name="username"
> value="{request-param:username}"/>
>         </map:transform>
> 
>         <map:serialize type="xml"/>
>       </map:match>
> 
> And this XML:
> 
>   <authentication>
>    	<users>
> 		<user>
> 			<name><sql:execute-query
> xmlns:sql="http://apache.org/cocoon/SQL/2.0"><sql:query>select username
> from sandbox where username='<sql:substitute-value
> name="username"/>'</sql:query></sql:execute-query></name>
> 		</user>
>    	</users>
>   </authentication>
> 
> And this XSL:
> 
> <xsl:param name="username"/>
>     
> 
> <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">
>     <!-- Compare the name of the user -->
>     <xsl:if test="normalize-space(name)=$username">
>         <!-- found, so create the ID -->
>         <ID><xsl:value-of select="name"/></ID>
>     </xsl:if>
> </xsl:template>
> 
> I can type the URL into the browser address bar:
> 
> http://localhost:8080/review6/authentication-fw-db/authenticate-db?username=JD
> 
> And get this XML as a response:
> 
> <authentication xmlns:sql="http://apache.org/cocoon/SQL/2.0">
> <ID>JD</ID>
> </authentication>
> 
> However, when trying to use this authentication resource with the login
> page, etc., it keeps kicking me back to the login page instead of
> returning the protected page.
> 
> Clues?
> 
> 
> ---------------------------------------------------------------------
> 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