cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Hoskens>
Subject Re: [Auth-FW] Edit authentication/data nodes
Date Tue, 05 Apr 2005 06:37:47 GMT

When I first used cocoon, I had xsp's all around. If I remember correctly, I did something
like this 
to get the value from the authentication session:


	String email = <xsp-session-fw:getxml  context="authentication" 
	String login = <xsp-session-fw:getxml  context="authentication"  path="/authentication/ID"/>;

email: <xsp:expr>email</xsp:expr> user: <xsp:expr>login</xsp-expr>

I never changed the value though and looking at the session-fw.xsl stylesheet, it seems that
isn't a way to set values. You may

Nowadays, I don't use xsp anymore. I now use flowscript to access the authenticationsession
and pass 
it in my bizdata:

var bizdata = new Object();
var contextMan = null;

contextMan =cocoon.getComponent(;
var sessionContext = contextMan.getContext("authentication");
var id = documentFragment2String(sessionContext.getXML("/authentication/ID"));
var userEmail = documentFragment2String(sessionContext.getXML("/authentication/data/UserEmail"));
bizdata["id"] = id;
bizdata["email"] = userEmail;
cocoon.sendPage("mypage", bizdata);

Pay attention to some restrictions on the authenticationsession, there are some functions
that are 
not available although the session interface does define them. Look at the api's to see what
you can 
do with the authenticationsession:

If you need to alter a lot of data in the session, you may want to consider adding a session
for this specific task alone (so not touching the authentication session):

contextManager =cocoon.getComponent(;
if (!contextManager.existsContext("Information"))
	contextManager.createContext("Information", null, null);
var sessionContext = contextManager.getContext("Information");
// showing how to set a result of a pipeline as xml in a sessioncontext
var pipelineUtil = cocoon.createObject(;
var document = pipelineUtil.processToDOM("mySessionSettingsToChange", null);
var documentFragment = document.createDocumentFragment();
sessionContext.setXML("Bestuur", documentFragment);

sessionContext.setAttribute("...", null);

If you don't want to use flowscript, the same can be done with the session tags:

<session:createcontext name="Information"/>
<session:setxml context="Information" path="/mypath/">
     <xsp:attribute name="src"><xsp:expr>myDynamicFormedPipelinePath</xsp:expr></xsp:attribute>

There are probably some more ways to do the same so you may want to look around a bit longer.

Kind regards,

Philippe Guillard wrote:
> Hi,
> I use Portal, so i use Auth-Fw, and want to change the data part for a 
> user without asking him to sign-in again.
> Lest's say i put nickname in the data section,
> <authentication>
>    <ID>foo_id</ID>
>    <data>foo_nickname</data>
> </authentication>
> and i want to afford the possibility for the user to change it's Nickname.
> Is there a simple way?  Today i can get the nickname from Sitemap 
> (InputModule), Flow, Java, XspSessionFw logicsheet, but i don't know a 
> simple way to use the set functions.
> AuthenticationFw/ SessionContext seems to be there to make session 
> attributes manipulation easier, so i think i lack some understanding on it.
> For the moment i just use the "normal" Session object doing this after 
> the <autentication> node made in XSP:
> <authentication>
>    <ID>foo_id</ID>
>    <data></data>
> </authentication>
> <xsp:logic>
>    session.setAttribute("nickname", "foo_nickname"); </xsp:logic>
> (i'm sad to mix these 2 things and i do not use the framework provided...)
> Regards,
> Phil
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message