You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by fabrizio picca <fa...@gmail.com> on 2004/09/17 22:38:24 UTC

authentication framework over a mysql connection

i'm new to cocoon and i'm trying to develop a web application for a
university examination.

I've read everything about Authentication FW but i cannot find nothing
about authenticating over
a mysql DB connection. so i've written down this piece of pipeline:

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

[...]



    <map:pipeline><!--questa deve essere internal-->
      <!-- This is the authentication resource -->
      <map:match pattern="authenticate">
        <map:generate src="login/do-login.xml"/>
        <map:transform src="stylesheets/do-login.xsl" label="debug6" >
          <map:parameter name="use-request-parameters" value="true"/>
        </map:transform>
	<map:transform type="sql" label="debug3"><!--effettua la query al database-->
	  <map:parameter name="use-connection" value="mysql"/>
        </map:transform>
	<map:transform src="stylesheets/authenticate.xsl" >
	  <map:parameter name="use-request-parameters" value="true"/>
	</map:transform>
	<map:transform type="encodeURL"/>
        <map:serialize type="xml" label="debug5"/>
      </map:match>
    </map:pipeline>

but i didn't reach anything but a redirect to the login page as i've
decided in the first piece of pipeline.

Can anyone tell me what's wrong?
Please!

-- 
copyright - fabpicca

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


Re: Re[2]: authentication framework over a mysql connection

Posted by fabrizio picca <fa...@gmail.com>.
those parameters are sent the same way as the example given in cocoon
documentation.
we tried maintaining the same pipeline structure and authenticating
over a xml file and t works.Is th database authentication that doesn't
works.

After the above mentioned sentence in the pipeline we have a so-formed
authentication pipeline:

    <map:pipeline internal-only="true">
      <!-- This is the authentication resource -->
      <map:match pattern="authenticate">
        <map:generate src="login/do-login.xml"/>
	<!--<map:generate src="docs/userlist.xml"/>-->
        <map:transform src="stylesheets/do-login.xsl" label="debug6"> 
          <map:parameter name="use-request-parameters" value="true"/>
        </map:transform>
	<map:transform type="sql" label="debug3">
	  <map:parameter name="use-connection" value="mysql"/>
        </map:transform>
	<map:transform src="stylesheets/authenticate.xsl" >
	  <map:parameter name="use-request-parameters" value="true"/>
	</map:transform>
	<map:transform type="encodeURL"/>
        <map:serialize type="xml" label="debug5"/>
      </map:match>
    </map:pipeline>

that first produce a file with the username mined out from the
database the second transformer validate the user .
here something doesn't work.

the file with the query is now, accordingly to the link you gave, like this:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:param name="name"/>
  <xsl:param name="pwd"/>
  <xsl:template match="authentication">
    <user>
      <execute-query xmlns="http://apache.org/cocoon/SQL/2.0"> 
	<query>
	    SELECT uid,username,password from users where username=
'<sql:substitute-value sql:name="username"/>'
	    and password = '<sql:substitute-value sql:name="password"/>' 
	</query>
      </execute-query>
    </user>
  </xsl:template>
</xsl:stylesheet>

but i still can get nothing out of it.

don't wanna bother anymore...sorry.


On Fri, 17 Sep 2004 23:39:02 +0200, g[R]eK <gr...@warsztat.pac.pl> wrote:
> <. Hi fabrizio! .>
> 
> Friday, September 17, 2004, 11:12:47 PM, you wrote:
> 
> fp> here it is the component configuration
> 
> fp>   <map:pipelines>
> fp>     <map:component-configurations>
> fp>       <authentication-manager>
> fp>         <handlers>
> fp>           <handler name="torquemada">
> fp>         <redirect-to uri="cocoon:loginsrc"/>
> 
> I think should be cocoon:/loginsrc.
> 
> fp>             <authentication uri="cocoon:raw:/authenticate"/>
> fp>           </handler>
> fp>         </handlers>
> fp>       </authentication-manager>
> fp>     </map:component-configurations>
> 
> Your piece sent before:
>         <map:act type="auth-login">
>           <map:parameter name="handler" value="torquemada"/>
>           <map:parameter name="parameter_name" value="{request-param:username}"/>
>           <map:parameter name="parameter_pwd" value="{request-param:password}"/>
>           <map:redirect-to uri="protected"/>
>         </map:act>
> 
> Also seems to be wrong. You must use internal redirect:
> http://cocoon.apache.org/2.1/userdocs/concepts/redirection.html#Internal+Redirects+Using+the+Cocoon+Protocol
> 
> Please paste result of athenticate match if you provide valid login&pass as
> parameters.
> 
> 
> 
> --
> Best regards
> <. g[R]eK mailto:gReK@warsztat.pac.pl                                    .>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 



-- 
copyright - fabpicca

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


Re[2]: authentication framework over a mysql connection

Posted by "g[R]eK" <gR...@warsztat.pac.pl>.
<. Hi fabrizio! .>

Friday, September 17, 2004, 11:12:47 PM, you wrote:

fp> here it is the component configuration  



fp>   <map:pipelines>
fp>     <map:component-configurations>
fp>       <authentication-manager>
fp>         <handlers>
fp>           <handler name="torquemada">
fp> 	    <redirect-to uri="cocoon:loginsrc"/>

I think should be cocoon:/loginsrc.

fp>             <authentication uri="cocoon:raw:/authenticate"/>
fp>           </handler>
fp>         </handlers>
fp>       </authentication-manager>
fp>     </map:component-configurations>

Your piece sent before:
        <map:act type="auth-login">
          <map:parameter name="handler" value="torquemada"/>
          <map:parameter name="parameter_name" value="{request-param:username}"/>
          <map:parameter name="parameter_pwd" value="{request-param:password}"/>
          <map:redirect-to uri="protected"/>
        </map:act>

Also seems to be wrong. You must use internal redirect:
http://cocoon.apache.org/2.1/userdocs/concepts/redirection.html#Internal+Redirects+Using+the+Cocoon+Protocol

Please paste result of athenticate match if you provide valid login&pass as
parameters.

-- 
Best regards
<. g[R]eK mailto:gReK@warsztat.pac.pl                                    .>


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


Re: authentication framework over a mysql connection

Posted by fabrizio picca <fa...@gmail.com>.
i attach also this lines....hope it can help:

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

and part of the file for the sql transformation:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:param name="name"/>
  <xsl:param name="pwd"/>
  <xsl:template match="authentication">
    <user>
      <execute-query xmlns="http://apache.org/cocoon/SQL/2.0"> 
	<query>
	    SELECT uid,username,password from users where username=
'<sql:substitute-value sql:name="username"/>'
	    and password = '<sql:substitute-value sql:name="password"/>' 
	</query>
      </execute-query>
    </user>
  </xsl:template>
</xsl:stylesheet>



On Fri, 17 Sep 2004 23:12:47 +0200, fabrizio picca
<fa...@gmail.com> wrote:
> here it is the component configuration
> 
>   <map:pipelines>
>     <map:component-configurations>
>       <authentication-manager>
>         <handlers>
>           <handler name="torquemada">
>             <redirect-to uri="cocoon:loginsrc"/>
>             <authentication uri="cocoon:raw:/authenticate"/>
>           </handler>
>         </handlers>
>       </authentication-manager>
>     </map:component-configurations>
> 
> 
> 
> 
> On Fri, 17 Sep 2004 23:05:20 +0200, g[R]eK <gr...@warsztat.pac.pl> wrote:
> > <. Hi fabrizio! .>
> >
> > Friday, September 17, 2004, 10:38:24 PM, you wrote:
> >
> > fp> i'm new to cocoon and i'm trying to develop a web application for a
> > fp> university examination.
> >
> > fp> I've read everything about Authentication FW but i cannot find nothing
> > fp> about authenticating over
> > fp> a mysql DB connection. so i've written down this piece of pipeline:
> >
> > <snip/>
> >
> > fp>     <map:pipeline><!--questa deve essere internal-->
> >
> > Authenticate match should be in internal only pipeline:
> > <map:pipeline internal-only="true">
> >
> > It will protect from non internal requests.
> >
> > fp>       <!-- This is the authentication resource -->
> > fp>       <map:match pattern="authenticate">
> > fp>         <map:generate src="login/do-login.xml"/>
> > fp>         <map:transform src="stylesheets/do-login.xsl" label="debug6" >
> > fp>           <map:parameter name="use-request-parameters" value="true"/>
> > fp>         </map:transform>
> >
> > I guess, above transform is only for include values of request parameters
> > (username, password). If I'm right you should use this SAFER method:
> > http://cocoon.apache.org/2.1/userdocs/transformers/sql-transformer.html#Substitution
> >
> > fp>     <map:transform type="sql" label="debug3"><!--effettua la query al database-->
> > fp>       <map:parameter name="use-connection" value="mysql"/>
> > fp>         </map:transform>
> > fp>     <map:transform src="stylesheets/authenticate.xsl" >
> > fp>       <map:parameter name="use-request-parameters" value="true"/>
> > fp>     </map:transform>
> > fp>     <map:transform type="encodeURL"/>
> > fp>         <map:serialize type="xml" label="debug5"/>
> > fp>       </map:match>
> >
> > I'm not sure what this transform is for.
> >
> > fp>     </map:pipeline>
> >
> > fp> but i didn't reach anything but a redirect to the login page as i've
> > fp> decided in the first piece of pipeline.
> >
> > fp> Can anyone tell me what's wrong?
> > fp> Please!
> >
> > Send your handler configuration, please.
> >
> > --
> > Best regards
> > <. g[R]eK mailto:gReK@warsztat.pac.pl                                    .>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
> 
> 
> --
> copyright - fabpicca
> 



-- 
copyright - fabpicca

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


Re: authentication framework over a mysql connection

Posted by fabrizio picca <fa...@gmail.com>.
here it is the component configuration  



  <map:pipelines>
    <map:component-configurations>
      <authentication-manager>
        <handlers>
          <handler name="torquemada">
	    <redirect-to uri="cocoon:loginsrc"/>
            <authentication uri="cocoon:raw:/authenticate"/>
          </handler>
        </handlers>
      </authentication-manager>
    </map:component-configurations>



On Fri, 17 Sep 2004 23:05:20 +0200, g[R]eK <gr...@warsztat.pac.pl> wrote:
> <. Hi fabrizio! .>
> 
> Friday, September 17, 2004, 10:38:24 PM, you wrote:
> 
> fp> i'm new to cocoon and i'm trying to develop a web application for a
> fp> university examination.
> 
> fp> I've read everything about Authentication FW but i cannot find nothing
> fp> about authenticating over
> fp> a mysql DB connection. so i've written down this piece of pipeline:
> 
> <snip/>
> 
> fp>     <map:pipeline><!--questa deve essere internal-->
> 
> Authenticate match should be in internal only pipeline:
> <map:pipeline internal-only="true">
> 
> It will protect from non internal requests.
> 
> fp>       <!-- This is the authentication resource -->
> fp>       <map:match pattern="authenticate">
> fp>         <map:generate src="login/do-login.xml"/>
> fp>         <map:transform src="stylesheets/do-login.xsl" label="debug6" >
> fp>           <map:parameter name="use-request-parameters" value="true"/>
> fp>         </map:transform>
> 
> I guess, above transform is only for include values of request parameters
> (username, password). If I'm right you should use this SAFER method:
> http://cocoon.apache.org/2.1/userdocs/transformers/sql-transformer.html#Substitution
> 
> fp>     <map:transform type="sql" label="debug3"><!--effettua la query al database-->
> fp>       <map:parameter name="use-connection" value="mysql"/>
> fp>         </map:transform>
> fp>     <map:transform src="stylesheets/authenticate.xsl" >
> fp>       <map:parameter name="use-request-parameters" value="true"/>
> fp>     </map:transform>
> fp>     <map:transform type="encodeURL"/>
> fp>         <map:serialize type="xml" label="debug5"/>
> fp>       </map:match>
> 
> I'm not sure what this transform is for.
> 
> fp>     </map:pipeline>
> 
> fp> but i didn't reach anything but a redirect to the login page as i've
> fp> decided in the first piece of pipeline.
> 
> fp> Can anyone tell me what's wrong?
> fp> Please!
> 
> Send your handler configuration, please.
> 
> --
> Best regards
> <. g[R]eK mailto:gReK@warsztat.pac.pl                                    .>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 



-- 
copyright - fabpicca

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


Re: authentication framework over a mysql connection

Posted by "g[R]eK" <gR...@warsztat.pac.pl>.
<. Hi fabrizio! .>

Friday, September 17, 2004, 10:38:24 PM, you wrote:

fp> i'm new to cocoon and i'm trying to develop a web application for a
fp> university examination.

fp> I've read everything about Authentication FW but i cannot find nothing
fp> about authenticating over
fp> a mysql DB connection. so i've written down this piece of pipeline:

<snip/>

fp>     <map:pipeline><!--questa deve essere internal-->

Authenticate match should be in internal only pipeline:
<map:pipeline internal-only="true">

It will protect from non internal requests.

fp>       <!-- This is the authentication resource -->
fp>       <map:match pattern="authenticate">
fp>         <map:generate src="login/do-login.xml"/>
fp>         <map:transform src="stylesheets/do-login.xsl" label="debug6" >
fp>           <map:parameter name="use-request-parameters" value="true"/>
fp>         </map:transform>

I guess, above transform is only for include values of request parameters
(username, password). If I'm right you should use this SAFER method:
http://cocoon.apache.org/2.1/userdocs/transformers/sql-transformer.html#Substitution

fp> 	<map:transform type="sql" label="debug3"><!--effettua la query al database-->
fp> 	  <map:parameter name="use-connection" value="mysql"/>
fp>         </map:transform>
fp> 	<map:transform src="stylesheets/authenticate.xsl" >
fp> 	  <map:parameter name="use-request-parameters" value="true"/>
fp> 	</map:transform>
fp> 	<map:transform type="encodeURL"/>
fp>         <map:serialize type="xml" label="debug5"/>
fp>       </map:match>

I'm not sure what this transform is for.

fp>     </map:pipeline>

fp> but i didn't reach anything but a redirect to the login page as i've
fp> decided in the first piece of pipeline.

fp> Can anyone tell me what's wrong?
fp> Please!

Send your handler configuration, please.

-- 
Best regards
<. g[R]eK mailto:gReK@warsztat.pac.pl                                    .>


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