You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Philippe Guillard <pg...@citycita.net> on 2005/04/04 18:47:27 UTC

[Auth-FW] Edit authentication/data nodes

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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: [Auth-FW] Edit authentication/data nodes

Posted by Philippe Guillard <pg...@citycita.net>.
Thanks a lot Yan,

Good idea to use another session context and not the one used by 
authentication framwork for the elements i need to save.  I also thought 
none of the set functions you shown here where available, i'll try.

Just one question reminds: doc says session framwork provides the 
session context that is XML data storage in the session, as i need to 
store a few parameters without hierarchy, i still wonder what is the 
advantage of using it instead of simply use sesion attributes 
(session.setAttribute("nickname", "foo")) ?

Regards,

Phil



Jan Hoskens wrote:

> Hi,
>
> 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:
>
> <xsp:page
>     xmlns:xsp="http://apache.org/xsp"
>     xmlns:xsp-session-fw="http://apache.org/xsp/session-fw/1.0">
>
> <xsp:logic>
>     String email = <xsp-session-fw:getxml  context="authentication" 
> path="/authentication/data/UserEmail"/>;
>     String login = <xsp-session-fw:getxml  context="authentication"  
> path="/authentication/ID"/>;
> </xsp:logic>
>
> 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 there 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;
> try
> {
>
> contextMan 
> =cocoon.getComponent(Packages.org.apache.cocoon.webapps.session.ContextManager.ROLE); 
>
> 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);
> }
> finally
> {
>     cocoon.releaseComponent(contextMan);
> }           
>
> 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: 
> http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/webapps/authentication/context/AuthenticationContext.html 
>
>
> If you need to alter a lot of data in the session, you may want to 
> consider adding a session context for this specific task alone (so not 
> touching the authentication session):
>
> contextManager 
> =cocoon.getComponent(Packages.org.apache.cocoon.webapps.session.ContextManager.ROLE); 
>
> 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(Packages.org.apache.cocoon.components.flow.util.PipelineUtil); 
>
> var document = pipelineUtil.processToDOM("mySessionSettingsToChange", 
> null);
> var documentFragment = document.createDocumentFragment();
> documentFragment.appendChild(document.getDocumentElement().cloneNode(true)); 
>
> sessionContext.setXML("Bestuur", documentFragment);
>
> ...
> sessionContext.removeXML("...");
> 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/">
> <cinclude:include>
>     <xsp:attribute 
> name="src"><xsp:expr>myDynamicFormedPipelinePath</xsp:expr></xsp:attribute> 
>
> </cinclude:include>
> </session:setxml>
>                
>
> There are probably some more ways to do the same so you may want to 
> look around a bit longer.
>
> Kind regards,
> Jan
>
> 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: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>


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


Re: [Auth-FW] Edit authentication/data nodes

Posted by Philippe Guillard <pg...@citycita.net>.
Thanks!

Jan Hoskens wrote:

> Philippe Guillard wrote:
>
>> Thanks a lot Jan,
>>
>> Good idea to use another session context and not the one used by 
>> authentication framwork for the elements i need to save.  I also 
>> thought none of the set functions you shown here where available, 
>> i'll try.
>>
>> Just one question reminds: doc says session framwork provides the 
>> session context that is XML data storage in the session, as i need to 
>> store a few parameters without hierarchy, i still wonder what is the 
>> advantage of using it instead of simply use sesion attributes 
>> (session.setAttribute("nickname", "foo")) ?
>
>
> As far as I know a sessioncontext is like a container in your session. 
> Every application can have it's own 'private' space in the session to 
> store it's objects. This way the authentication framework reserves the 
> context 'authentication' for its needs. If you only need to store some 
> global attributes, the user session will be enough. If you need xml 
> storage or want to have separate spaces for different goals/apps you 
> might want to use contexts.
>
> Well that's my point of view of course, ;-)
>
> Kind regards,
> Jan
>
>>
>> Regards,
>>
>> Phil
>>
>>
>>
>> Jan Hoskens wrote:
>>
>>> Hi,
>>>
>>> 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:
>>>
>>> <xsp:page
>>>     xmlns:xsp="http://apache.org/xsp"
>>>     xmlns:xsp-session-fw="http://apache.org/xsp/session-fw/1.0">
>>>
>>> <xsp:logic>
>>>     String email = <xsp-session-fw:getxml  context="authentication" 
>>> path="/authentication/data/UserEmail"/>;
>>>     String login = <xsp-session-fw:getxml  context="authentication"  
>>> path="/authentication/ID"/>;
>>> </xsp:logic>
>>>
>>> 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 there 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;
>>> try
>>> {
>>>
>>> contextMan 
>>> =cocoon.getComponent(Packages.org.apache.cocoon.webapps.session.ContextManager.ROLE); 
>>>
>>> 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);
>>> }
>>> finally
>>> {
>>>     cocoon.releaseComponent(contextMan);
>>> }          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: 
>>> http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/webapps/authentication/context/AuthenticationContext.html 
>>>
>>>
>>> If you need to alter a lot of data in the session, you may want to 
>>> consider adding a session context for this specific task alone (so 
>>> not touching the authentication session):
>>>
>>> contextManager 
>>> =cocoon.getComponent(Packages.org.apache.cocoon.webapps.session.ContextManager.ROLE); 
>>>
>>> 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(Packages.org.apache.cocoon.components.flow.util.PipelineUtil); 
>>>
>>> var document = 
>>> pipelineUtil.processToDOM("mySessionSettingsToChange", null);
>>> var documentFragment = document.createDocumentFragment();
>>> documentFragment.appendChild(document.getDocumentElement().cloneNode(true)); 
>>>
>>> sessionContext.setXML("Bestuur", documentFragment);
>>>
>>> ...
>>> sessionContext.removeXML("...");
>>> 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/">
>>> <cinclude:include>
>>>     <xsp:attribute 
>>> name="src"><xsp:expr>myDynamicFormedPipelinePath</xsp:expr></xsp:attribute> 
>>>
>>> </cinclude:include>
>>> </session:setxml>
>>>               There are probably some more ways to do the same so 
>>> you may want to look around a bit longer.
>>>
>>> Kind regards,
>>> Jan
>>>
>>> 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: users-unsubscribe@cocoon.apache.org
>>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>


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


Re: [Auth-FW] Edit authentication/data nodes

Posted by Jan Hoskens <jh...@schaubroeck.be>.
Philippe Guillard wrote:
> Thanks a lot Jan,
> 
> Good idea to use another session context and not the one used by 
> authentication framwork for the elements i need to save.  I also thought 
> none of the set functions you shown here where available, i'll try.
> 
> Just one question reminds: doc says session framwork provides the 
> session context that is XML data storage in the session, as i need to 
> store a few parameters without hierarchy, i still wonder what is the 
> advantage of using it instead of simply use sesion attributes 
> (session.setAttribute("nickname", "foo")) ?

As far as I know a sessioncontext is like a container in your session. Every application can have 
it's own 'private' space in the session to store it's objects. This way the authentication framework 
reserves the context 'authentication' for its needs. If you only need to store some global 
attributes, the user session will be enough. If you need xml storage or want to have separate spaces 
for different goals/apps you might want to use contexts.

Well that's my point of view of course, ;-)

Kind regards,
Jan

> 
> Regards,
> 
> Phil
> 
> 
> 
> Jan Hoskens wrote:
> 
>> Hi,
>>
>> 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:
>>
>> <xsp:page
>>     xmlns:xsp="http://apache.org/xsp"
>>     xmlns:xsp-session-fw="http://apache.org/xsp/session-fw/1.0">
>>
>> <xsp:logic>
>>     String email = <xsp-session-fw:getxml  context="authentication" 
>> path="/authentication/data/UserEmail"/>;
>>     String login = <xsp-session-fw:getxml  context="authentication"  
>> path="/authentication/ID"/>;
>> </xsp:logic>
>>
>> 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 there 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;
>> try
>> {
>>
>> contextMan 
>> =cocoon.getComponent(Packages.org.apache.cocoon.webapps.session.ContextManager.ROLE); 
>>
>> 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);
>> }
>> finally
>> {
>>     cocoon.releaseComponent(contextMan);
>> }          
>> 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: 
>> http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/webapps/authentication/context/AuthenticationContext.html 
>>
>>
>> If you need to alter a lot of data in the session, you may want to 
>> consider adding a session context for this specific task alone (so not 
>> touching the authentication session):
>>
>> contextManager 
>> =cocoon.getComponent(Packages.org.apache.cocoon.webapps.session.ContextManager.ROLE); 
>>
>> 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(Packages.org.apache.cocoon.components.flow.util.PipelineUtil); 
>>
>> var document = pipelineUtil.processToDOM("mySessionSettingsToChange", 
>> null);
>> var documentFragment = document.createDocumentFragment();
>> documentFragment.appendChild(document.getDocumentElement().cloneNode(true)); 
>>
>> sessionContext.setXML("Bestuur", documentFragment);
>>
>> ...
>> sessionContext.removeXML("...");
>> 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/">
>> <cinclude:include>
>>     <xsp:attribute 
>> name="src"><xsp:expr>myDynamicFormedPipelinePath</xsp:expr></xsp:attribute> 
>>
>> </cinclude:include>
>> </session:setxml>
>>               
>> There are probably some more ways to do the same so you may want to 
>> look around a bit longer.
>>
>> Kind regards,
>> Jan
>>
>> 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: users-unsubscribe@cocoon.apache.org
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 


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


Re: [Auth-FW] Edit authentication/data nodes

Posted by Philippe Guillard <pg...@citycita.net>.
Thanks a lot Jan,

Good idea to use another session context and not the one used by 
authentication framwork for the elements i need to save.  I also thought 
none of the set functions you shown here where available, i'll try.

Just one question reminds: doc says session framwork provides the 
session context that is XML data storage in the session, as i need to 
store a few parameters without hierarchy, i still wonder what is the 
advantage of using it instead of simply use sesion attributes 
(session.setAttribute("nickname", "foo")) ?

Regards,

Phil



Jan Hoskens wrote:

> Hi,
>
> 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:
>
> <xsp:page
>     xmlns:xsp="http://apache.org/xsp"
>     xmlns:xsp-session-fw="http://apache.org/xsp/session-fw/1.0">
>
> <xsp:logic>
>     String email = <xsp-session-fw:getxml  context="authentication" 
> path="/authentication/data/UserEmail"/>;
>     String login = <xsp-session-fw:getxml  context="authentication"  
> path="/authentication/ID"/>;
> </xsp:logic>
>
> 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 there 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;
> try
> {
>
> contextMan 
> =cocoon.getComponent(Packages.org.apache.cocoon.webapps.session.ContextManager.ROLE); 
>
> 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);
> }
> finally
> {
>     cocoon.releaseComponent(contextMan);
> }           
>
> 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: 
> http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/webapps/authentication/context/AuthenticationContext.html 
>
>
> If you need to alter a lot of data in the session, you may want to 
> consider adding a session context for this specific task alone (so not 
> touching the authentication session):
>
> contextManager 
> =cocoon.getComponent(Packages.org.apache.cocoon.webapps.session.ContextManager.ROLE); 
>
> 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(Packages.org.apache.cocoon.components.flow.util.PipelineUtil); 
>
> var document = pipelineUtil.processToDOM("mySessionSettingsToChange", 
> null);
> var documentFragment = document.createDocumentFragment();
> documentFragment.appendChild(document.getDocumentElement().cloneNode(true)); 
>
> sessionContext.setXML("Bestuur", documentFragment);
>
> ...
> sessionContext.removeXML("...");
> 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/">
> <cinclude:include>
>     <xsp:attribute 
> name="src"><xsp:expr>myDynamicFormedPipelinePath</xsp:expr></xsp:attribute> 
>
> </cinclude:include>
> </session:setxml>
>                
>
> There are probably some more ways to do the same so you may want to 
> look around a bit longer.
>
> Kind regards,
> Jan
>
> 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: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>


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


Re: [Auth-FW] Edit authentication/data nodes

Posted by Jan Hoskens <jh...@schaubroeck.be>.
Hi,

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:

<xsp:page
	xmlns:xsp="http://apache.org/xsp"
	xmlns:xsp-session-fw="http://apache.org/xsp/session-fw/1.0">

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

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 there 
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;
try
{

contextMan =cocoon.getComponent(Packages.org.apache.cocoon.webapps.session.ContextManager.ROLE);
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);
}
finally
{
	cocoon.releaseComponent(contextMan);
}			

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: 
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/webapps/authentication/context/AuthenticationContext.html

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

contextManager =cocoon.getComponent(Packages.org.apache.cocoon.webapps.session.ContextManager.ROLE);
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(Packages.org.apache.cocoon.components.flow.util.PipelineUtil);
var document = pipelineUtil.processToDOM("mySessionSettingsToChange", null);
var documentFragment = document.createDocumentFragment();
documentFragment.appendChild(document.getDocumentElement().cloneNode(true));
sessionContext.setXML("Bestuur", documentFragment);

...
sessionContext.removeXML("...");
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/">
<cinclude:include>
     <xsp:attribute name="src"><xsp:expr>myDynamicFormedPipelinePath</xsp:expr></xsp:attribute>
</cinclude:include>
</session:setxml>
				

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

Kind regards,
Jan

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: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 


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