You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Markus Schulze <ma...@bg-sys.de> on 2003/06/13 13:50:38 UTC

auth session context and session-attr

Hello,

is it possible to retrieve session values created by the LoginAction
(context="authentication") with the Session-Attr Input Module?

eg.:

            <map:transform type="xslt" src="style/main.xsl" label="raw">
                <map:parameter name="myauth" value="
{session-attr:authentication/authentication/ID}"/>
                <map:parameter name="date" value="{date:date}"/>
            </map:transform>

As I already successfully tried, I can use the session-transformer to
retrieve the values in my main.xsl with
<session:getxml context="authentication" path="/authentication/ID"> but I
want to use this value in  an xsl:variable in the style sheet.
This does not seem to be possible, since the session transformer has to be
applied after the xsl-transformation.

Any ideas somebody?

Markus Schulze





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


Re: auth session context and session-attr

Posted by Edison Too <ed...@yahoo.com.sg>.
Hi,

I was also 'agonizing' how to get the user Id in a typical site map without using {../../../ID} !

After digging around the source, I have 2 ideas
1) Modify DefaultContextManager in Session framework to store each Session Context into the Session using their context name as the Session Attribute. In this way we might be able to use 
	{session:attribute[@name='authentication']/authentication/ID}
	However this may not be possible as this gives up the ability to protect the reserved Session Context such as Request, Response etc.
2) Write a SessionContext Input Module to read out the attributes. We might then be able to do this
	{session-context:authentication:/authentication/ID}

Until that is available, here is my solution to your problem. 

Add this to your sitemap's set of actions

    <map:action logger="sitemap.action.session-propagator" name="session-prop" src="org.apache.cocoon.acting.SessionPropagatorAction"/>

Add this right inside your existing auth-login action

     <map:act type="session-prop">
     	<map:parameter name="userid" value="{ID}"/>
         <map:parameter name="password" value="{password}"/>
     </map:act>

When you need the user ID just use

     <map:parameter name="userid" value="{session-attr:userid}"/>

The session propagation action writes the ID and password emitted by the auth-login action into session attributes. You can then access the value using session-attr input module.

Cheers,
Edison

On Fri, 13 Jun 2003 13:50:38 +0200, Markus Schulze wrote:
>Hello,
>
>is it possible to retrieve session values created by the LoginAction
>(context="authentication") with the Session-Attr Input Module?
>
>eg.:
>
><map:transform type="xslt" src="style/main.xsl" label="raw">�<map:parameter
>name="myauth" value=" {session-attr:authentication/authentication/ID}"/>
><map:parameter name="date" value="{date:date}"/>�</map:transform>
>
>As I already successfully tried, I can use the session-transformer to retrieve
>the values in my main.xsl with <session:getxml context="authentication"
>path="/authentication/ID">�but I want to use this value in �an xsl:variable in
>the style sheet. This does not seem to be possible, since the session
>transformer has to be applied after the xsl-transformation.
>
>Any ideas somebody?
>
>Markus Schulze
>
>
>
>
>
>--------------------------------------------------------------------- To
>unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org For additional
>commands, e-mail: cocoon-users-help@xml.apache.org



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