On 8 Dec 2003, at 13:33, Jean-Christophe Kermagoret wrote:


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"]

this is a param passed from my sitemap to my flowscript, it is the name of the authorisation handler

<map:component-configurations>
        <authentication-manager>
                <handlers>
                        <handler name="myAuthorisation">
                                <redirect-to uri="cocoon:/login"/>
                                <authentication uri="cocoon:raw:/authenticate"/>
                        </handler>
                </handlers>
        </authentication-manager>
</map:component-configurations>

. . .

<map:match pattern="do-login">
        <!-- try to login -->
        <map:call function="woody">
                <map:parameter name="function" value="login"/>
                . . .
                <map:parameter name="handler" value="myAuthorisation"/>
                . . .
        </map:call>
</map:match>

function login(form) {
  . . .
  var handler = cocoon.parameters["handler"];
  . . .
}

* and what is authParams ?

These are the parameters that get passed to the 'authenticate' pipeline.

See cocoon/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/ authentication/flow/javascript/auth.js

See the function called 'auth_login'.

I took this and adapted it to return the UserHandler rather than a boolean.


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.AuthenticationManag er .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
[EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Attachment: smime.p7s
Description: S/MIME cryptographic signature



Reply via email to