cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Christophe Kermagoret <...@babelobjects.com>
Subject Re: Access session user data from flow
Date Mon, 08 Dec 2003 13:33:11 GMT

Hello Jeremy,
thanks for your feedback.

1st method is ok.
I'd like to use the second method too, but :
* I get null handler with cocoon.parameters["handler"]
* and what is authParams ?

Regards,

Jeremy Quinn wrote:

>
> On 6 Dec 2003, at 20:26, Jean-Christophe Kermagoret wrote:
>
>> Hi List,
>> it it possible to access from flow user data stored in the session  
>> after an authentication ?
>>
>> I authenticate with success and I put the following data in the  
>> session :
>>
>> /authentication
>>  /ID
>>  /data
>>        /firstname
>>        /surname
>> ...
>>
>> How to access it with Flowscript ?
>
>
> There are two possibilities that I know of ...... there are probably  
> more ....
>
> 1. Via input modules :
>
> <map:parameter name="userid"  
> value="{session-context:authentication/authentication/ID}"/>
>
> which might be used to get the Sitemap to pass a parameter from the  
> Session Context to your FlowScript.
>
> 2. Via the AuthenticationManager at login time :
>
> The auth flowscripts call the 'login' method of  
> 'AuthenticationManager'. 'login' returns a 'UserHandler', the  
> 'UserHandler' can give you access to your data:
>
> var authMgr = cocoon.getComponent    
>      
> (Packages.org.apache.cocoon.webapps.authentication.AuthenticationManager 
> .ROLE);
> var userhandler =  authMgr.login (handler, null, authParams);
> if (userhandler != null) {
>     cocoon.log.info ("firstname: " + userhandler.getContext  
> ().getContextInfo ().get ("firstname"));
>     cocoon.log.info ("surname: " + userhandler.getContext  
> ().getContextInfo ().get ("surname"));
> }
>
>
> Keep in mind that the authentication context is only available while  
> you are in a protected URL.
>
> HTH
>
> regards Jeremy



-- 

Jean-Christophe Kermagoret
jck@BabelObjects.Com



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


Mime
View raw message