On February 26, 2004, Jean-Luc wrote:
> Now, I would like to access from 'index.xsp' the tag 'data' which is
returned
> by my Authenticator, in order to display a message in the result HTML
page. Is
> anybody knows how to do that ? I've tried with session context but with
no
> success ...
Hi Jean-Luc,
If I understand correctly, you're asking how to pass a failure message
back to a login screen. When you set your authentication as:
<authentication>
<data>reason</data>
</authentication>
you've indicated to cocoon that the authentication failed. So, this does
NOT in fact get stored in the session context, but is available in the
temporary context while still in the authentication pipeline. In the part
of you pipeline, you can access the temporary context.
I personally have my login form running a simple XML file through an xslt.
The XML file simply contains:
<?xml version="1.0" encoding="UTF-8"?>
<login xmlns:session="http://apache.org/cocoon/session/1.0">
<authentication>
<session:getxml context="temporary" path="/"/>
</authentication>
</login>
which gets run through this pipeline:
<map:match pattern="login.html">
<map:generate src="docs/login/login.xml"/>
<map:transform type="session"/>
<map:transform src="stylesheets/login/login.xslt"/>
<map:transform type="augment"/>
<map:serialize type="xhtml"/>
</map:match>
which assures me that each time the login form is pulled up (including
when a login failure occurs), my form has access to the temporary context.
Which, in my case, I put the error as:
<authentication>
<data>
<error>Error Message</error>
</data>
<authentcation>
so my login.xml winds up presenting to login.xslt:
<login>
<authentication>
<data>
<error>Error Message</error>
</data>
<authentcation>
</login>
In your case:
> <map:match pattern="login">
> <map:act type="auth-login">
> <map:parameter name="handler" value="rb-handler"/>
> <map:parameter name="parameter_login"
value="{request-param:login}"/>
> <map:parameter name="parameter_passwd"
value="{request-param:passwd}"/>
> <map:redirect-to uri="success.xsp"/>
> </map:act>
>
> <!-- Login has failed -->
> <map:generate src="pages/logic/index.xsp"/>
> <map:transform src="pages/stylesheet/index.xsl"/>
> <map:serialize/>
> </map:match>
You should be able to access your error message in index.xsp using the
temporary context.
Please see:
http://cocoon.apache.org/2.1/developing/webapps/authentication.html
<quote>
If the authentication fails, the action does not deliver a map and
therefore the commands inside the map:act are skipped. The error
information delivered by the authentication resource is stored into the
temporary context. So you can get the information using either the session
transformer or the session-context input module.
</quote>
HTH!
Thanks!
David Day
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]