I am trying to get simple authentication to work for a single document,
using local files for the authentication step, but I can't get it to return an authentication success.

The following works fine when run using Saxon from the commandline,
with userid=peter and password=GHYTFVN.map4h (ie it returns the expected authentication XML:
<authentication><ID>abcd</ID><role>*</role><data>authok:peter</data></authentication>
and when run with other data it returns the failure:
<authentication><data>authfail:peter</data></authentication>
as described in
http://cocoon.apache.org/2.1/developing/webapps/authentication.html

But run via Cocoon it only fails. Does Cocoon automatically perform the required crypt(3) on the password string from the form before passing the parameter_password into the handler authentication URI?

///Peter

XML:
<users>
  <user id="peter" authority="abcd">
    <name>Peter Flynn</name>
    <branchuri>*</branchuri>
    <crypt>GHYTFVN.map4h</crypt>
  </user>
</users>

XSLT:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.0">

  <xsl:output method="xml"/>
  <xsl:param name="userid"/>
  <xsl:param name="password"/>

  <xsl:template match="/">
    <authentication>
      <xsl:choose>
        <xsl:when test="users/user/@id=$userid and
                        users/[EMAIL PROTECTED]/crypt=$password">
          <ID>
            <xsl:value-of select="users/[EMAIL PROTECTED]/@authority"/>
          </ID>
          <role>
            <xsl:value-of select="users/[EMAIL PROTECTED]/branchuri">
          </role>
          <data>
            <xsl:text>authok:</xsl:text>
            <xsl:value-of select="users/[EMAIL PROTECTED]/@id"/>
          </data>
        </xsl:when>
        <xsl:otherwise>
          <data>
            <xsl:text>authfail:</xsl:text>
            <xsl:value-of select="users/[EMAIL PROTECTED]/@id"/>
          </data>
        </xsl:otherwise>
      </xsl:choose>
    </authentication>
  </xsl:template>

</xsl:stylesheet>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to