<. 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:[EMAIL PROTECTED]: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:[EMAIL PROTECTED] .>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]