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/18 18:22:43 UTC

desperate help on authentication framework and mysql connection

can someone provide me some exemples of authentication Framework with
Mysql db connection? please , i'm desperate in trying to solve my
problem...

-- 
copyright - fabpicca

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


Re: Re[4]: desperate help on authentication framework and mysql connection

Posted by fabrizio picca <fa...@gmail.com>.
i've tried modifying to get something like the example you gave me,
but i have still problems with parameters.

the statement 

<sql:substitute-value sql:name="username"/>

is susbstituted with an empty  string .the same for password.




On Sat, 18 Sep 2004 19:19:26 +0200, fabrizio picca
<fa...@gmail.com> wrote:
> ok sorry, i didn't saw it...thanks a lot
> 
> 
> 
> 
> On Sat, 18 Sep 2004 19:18:30 +0200, g[R]eK <gr...@warsztat.pac.pl> wrote:
> > <. Hi fabrizio! .>
> >
> > Saturday, September 18, 2004, 7:12:52 PM, you wrote:
> >
> > fp> ehm no, sorry i mean the authentication resource
> > fp> thant one that start like this:
> >
> > fp> <map:match pattern="authenticate">
> >
> > Oh, I sent it already :-)
> > Look for it after handler configuration...
> >
> >
> >
> > --
> > 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: Re[4]: desperate help on authentication framework and mysql connection

Posted by fabrizio picca <fa...@gmail.com>.
ok sorry, i didn't saw it...thanks a lot 


On Sat, 18 Sep 2004 19:18:30 +0200, g[R]eK <gr...@warsztat.pac.pl> wrote:
> <. Hi fabrizio! .>
> 
> Saturday, September 18, 2004, 7:12:52 PM, you wrote:
> 
> fp> ehm no, sorry i mean the authentication resource
> fp> thant one that start like this:
> 
> fp> <map:match pattern="authenticate">
> 
> Oh, I sent it already :-)
> Look for it after handler configuration...
> 
> 
> 
> --
> 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[4]: desperate help on authentication framework and mysql connection

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

Saturday, September 18, 2004, 7:12:52 PM, you wrote:

fp> ehm no, sorry i mean the authentication resource 
fp> thant one that start like this:

fp> <map:match pattern="authenticate">

Oh, I sent it already :-)
Look for it after handler configuration...

-- 
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: Re[2]: desperate help on authentication framework and mysql connection

Posted by fabrizio picca <fa...@gmail.com>.
ehm no, sorry i mean the authentication resource 
thant one that start like this:

<map:match pattern="authenticate">


On Sat, 18 Sep 2004 19:10:44 +0200, g[R]eK <gr...@warsztat.pac.pl> wrote:
> <. Hi fabrizio! .>
> 
> Saturday, September 18, 2004, 7:05:06 PM, you wrote:
> 
> fp> could you please post also the authentication pipeline?
> 
> I guess you asked for protected pipeline?
>                         <map:match pattern="*/**.html">
>                                         <map:act type="auth-protect">
>                                                 <map:parameter name="application" value="gdpl"/>
>                                                 <map:parameter name="handler" value="warsztat-auth"/>
>                                                 <map:redirect-to uri="cocoon:/internal/{../1}/{../2}" session="yes"/>
>                                         </map:act>
>                         </map:match>
> 
> 
> 
> --
> 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]: desperate help on authentication framework and mysql connection

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

Saturday, September 18, 2004, 7:05:06 PM, you wrote:

fp> could you please post also the authentication pipeline?

I guess you asked for protected pipeline?
                        <map:match pattern="*/**.html">
                                        <map:act type="auth-protect">
                                                <map:parameter name="application" value="gdpl"/>
                                                <map:parameter name="handler" value="warsztat-auth"/>
                                                <map:redirect-to uri="cocoon:/internal/{../1}/{../2}" session="yes"/>
                                        </map:act>
                        </map:match>

-- 
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: desperate help on authentication framework and mysql connection

Posted by fabrizio picca <fa...@gmail.com>.
could you please post also the authentication pipeline?

thanks a lot.


On Sat, 18 Sep 2004 18:43:53 +0200, g[R]eK <gr...@warsztat.pac.pl> wrote:
> <. Hi fabrizio! .>
> 
> Saturday, September 18, 2004, 6:22:43 PM, you wrote:
> 
> fp> can someone provide me some exemples of authentication Framework with
> fp> Mysql db connection? please , i'm desperate in trying to solve my
> fp> problem...
> 
> sitemap:
> 
>                                         <handler name="warsztat-auth">
>                                                 <redirect-to uri="cocoon://warsztat/users/login.html"/>
>                                                 <authentication uri="cocoon:raw:/authenticate"/>
>                                                 <!-- applications are optional
>                                                 -->
>                                                 <applications>
>                                                         <application name="gdpl">
>                                                                 <load uri="cocoon:/LoadUser"/>
>                                                         </application>
>                                                 </applications>
>                                         </handler>
> 
>                 <map:pipeline internal-only="true" id="internal-resources">
>                         <map:match pattern="authenticate">
>                                 <map:generate src="users/authenticate-template.xml"/>
>                                 <map:transform type="sql">
>                                         <map:parameter name="username" value="{request-param:username}"/>
>                                         <map:parameter name="password" value="{request-param:password}"/>
>                                         <map:parameter name="show-nr-of-rows" value="true"/>
>                                         <map:parameter name="use-connection" value="warsztat"/>
>                                 </map:transform>
>                                 <map:transform src="users/authenticate.xsl"/>
>                                 <map:serialize type="xml"/>
>                         </map:match>
>                 [...]
>                 </map:pipeline>
> 
> authenticate-template.xml:
> <authenticate xmlns:sql="http://apache.org/cocoon/SQL/2.0">
>         <sql:execute-query>
>                 <sql:query name="authenticate">
>                         SELECT
>                         user_id,
>                         username,
>                         warsztat_privilege_level
>                         FROM forum_users
>                         WHERE
>                         username = '<sql:substitute-value sql:name="username"/>'
>                         AND
>                         user_password = md5('<sql:substitute-value sql:name="password"/>')
>                         ;
>                 </sql:query>
>         </sql:execute-query>
> </authenticate>
> 
> authenticate.xsl:
> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:sql="http://apache.org/cocoon/SQL/2.0">
>         <xsl:template match="authenticate">
>                 <authentication>
>                 <xsl:choose>
>                         <xsl:when test="sql:rowset[@sql:nrofrows > 0]">
>                                 <ID><xsl:value-of select="sql:rowset/sql:row/sql:user_id"/></ID>
>                                 <role><xsl:value-of select="sql:rowset/sql:row/sql:warsztat_privilege_level"/></role>
>                                 <data><xsl:copy-of select="sql:rowset/sql:row/sql:*"/></data>
>                         </xsl:when>
>                         <xsl:otherwise>
>                                 <data>Some error</data>
>                         </xsl:otherwise>
>                 </xsl:choose>
>                 </authentication>
>         </xsl:template>
> </xsl:stylesheet>
> 
> Hope this help.
> 
> --
> 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: desperate help on authentication framework and mysql connection

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

Saturday, September 18, 2004, 6:22:43 PM, you wrote:

fp> can someone provide me some exemples of authentication Framework with
fp> Mysql db connection? please , i'm desperate in trying to solve my
fp> problem...

sitemap:

                                        <handler name="warsztat-auth">
                                                <redirect-to uri="cocoon://warsztat/users/login.html"/>
                                                <authentication uri="cocoon:raw:/authenticate"/>
                                                <!-- applications are optional
                                                -->
                                                <applications>
                                                        <application name="gdpl">
                                                                <load uri="cocoon:/LoadUser"/>
                                                        </application>
                                                </applications>
                                        </handler>

                <map:pipeline internal-only="true" id="internal-resources">
                        <map:match pattern="authenticate">
                                <map:generate src="users/authenticate-template.xml"/>
                                <map:transform type="sql">
                                        <map:parameter name="username" value="{request-param:username}"/>
                                        <map:parameter name="password" value="{request-param:password}"/>
                                        <map:parameter name="show-nr-of-rows" value="true"/>
                                        <map:parameter name="use-connection" value="warsztat"/>
                                </map:transform>
                                <map:transform src="users/authenticate.xsl"/>
                                <map:serialize type="xml"/>
                        </map:match>
                [...]
                </map:pipeline>

authenticate-template.xml:
<authenticate xmlns:sql="http://apache.org/cocoon/SQL/2.0">
        <sql:execute-query>
                <sql:query name="authenticate">
                        SELECT
                        user_id,
                        username,
                        warsztat_privilege_level
                        FROM forum_users
                        WHERE 
                        username = '<sql:substitute-value sql:name="username"/>'
                        AND
                        user_password = md5('<sql:substitute-value sql:name="password"/>')
                        ;
                </sql:query>
        </sql:execute-query>
</authenticate>

authenticate.xsl:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:sql="http://apache.org/cocoon/SQL/2.0">
        <xsl:template match="authenticate">
                <authentication>
                <xsl:choose>
                        <xsl:when test="sql:rowset[@sql:nrofrows > 0]">
                                <ID><xsl:value-of select="sql:rowset/sql:row/sql:user_id"/></ID>
                                <role><xsl:value-of select="sql:rowset/sql:row/sql:warsztat_privilege_level"/></role>
                                <data><xsl:copy-of select="sql:rowset/sql:row/sql:*"/></data>
                        </xsl:when>
                        <xsl:otherwise>
                                <data>Some error</data>
                        </xsl:otherwise>
                </xsl:choose>
                </authentication>
        </xsl:template>
</xsl:stylesheet>

Hope this help.

-- 
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