You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Malick Fall <Ma...@CoolFineNice.com> on 2002/12/19 04:20:50 UTC

Use of SessionPropagatorAction

Hi all,

I am a new Cocoon user trying to build a Web application.

Do you have some examples on how to use your SessionPropagatorAction.

I have an http service responsible for Authenticating my users.
http://WindowsBox:1010/login.asp

My sitemap looks like this:

<map:match pattern="">
    <map:act type="request">
        <map:parameter name="parameters" value="true"/>
        <map:parameter name="default.user" value="foo"/>
        <map:parameter name="default.pwd" value="bar"/>
        <map:generate
src="http://WindowsBox:1010/login.asp?userid={user}&amp;pwd={pwd}"/>
    </map:act>
    <map:serialize type="xml"/>
</map:match>


So I send the username and password to the Http service and get XML back w/
the user info if the Authentication was successful. Something like

<userinfo>
<userid>foo</userid><password>bar</password>
<address>...</address><email>...</email>
</userinfo>

Otherwise you get an userinfo element with an error code/message in it
<userinfo>
<errorcode>123</errorcode>
<errormsg>Wrong username/password, try again.</errormsg>
</userinfo>

At this point I need to store in the session the username, password,
sessionID and a flag that proves that the authentication was successful. It
cannot happen in an XSP because my Authentication service is HTTP, which
becomes a generator in my sitemap.

After my generator I would like to store /userinfo/userid and
userinfo/password in the session. So I can check is the user was
authenticated B4 letting them go through any other pipeline.

I figured SessionPropagatorAction should be the answer, but I cannot figure
out where and how to use it.

<map:act type="session-propagator">
      <paramater name="user" value="{/userinfo/userid}">
      <paramater name="pwd" value="{/userinfo/password}">
	<paramater name="sessionID" value="???">
 </map:act>

Any help would be greatly appreciated.

Thanks, Cocoon *Really Rocks*

./Malick.
Malick@CoolFineNice.com


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Use of SessionPropagatorAction

Posted by "John R. Callahan" <jc...@sphere.com>.
Hey Malick!

(We met at the DC XML User's Group last month)...

I am not familiar with the SessionPropagatorAction, but I recommend
that you take a look at the authentication-fw (Authentication framework)
in Cocoon 2.1dev.  Instead of the default authentication handler as found
in the examples, you can use your login.asp service to authenticate users.

Here is an example:

     <!-- The file-based authentication resource from the auth-fw sample -->
     <map:match pattern="authenticate">
       <map:generate src="xml/userlist.xml"/>
       <map:transform src="xsl/authenticate.xsl">
         <map:parameter name="use-request-parameters" value="true"/>
       </map:transform>
       <map:serialize type="xml"/>
     </map:match>

     <!-- This is the eXSP authentication resource -->
     <map:match pattern="yourauthhandler">
       <map:act>
         <map:parameter name="parameters" value="true"/>
         <map:generate
src="http://WindowsBox:1010/login.asp?userid={user}&amp;pwd={pwd}"/>
         <map:transform src="asp2authfw.xsl"/>
         <map:serialize type="xml"/>
       </map:act>
       <map:read src="nullauth.xml"/>
     </map:match>

Mind you, this is just off the top of my head.  You might
still have to worry about URLEncoding issues, etc.  But
you should get the basic idea.  Check out the auth-fw in
the Cocoon samples first.  I made some additional
comments to your email below.

Take care and see you next month...

-- jack

John R. Callahan, Ph.D.
CTO
Sphere Software Corporation (www.sphere.com) - The Intelligence of XML
jcallahan@sphere.com
410-480-7301
509-352-1536 (eFax)
410-598-2157 (cell)



----- Original Message -----
From: "Malick Fall" <Ma...@CoolFineNice.com>
To: <co...@xml.apache.org>
Sent: Wednesday, December 18, 2002 7:20 PM
Subject: Use of SessionPropagatorAction


> Hi all,
>
> I am a new Cocoon user trying to build a Web application.
>
> Do you have some examples on how to use your SessionPropagatorAction.
>
> I have an http service responsible for Authenticating my users.
> http://WindowsBox:1010/login.asp
>
> My sitemap looks like this:
>
> <map:match pattern="">
>     <map:act type="request">
>         <map:parameter name="parameters" value="true"/>
>         <map:parameter name="default.user" value="foo"/>
>         <map:parameter name="default.pwd" value="bar"/>
>         <map:generate
> src="http://WindowsBox:1010/login.asp?userid={user}&amp;pwd={pwd}"/>
>     </map:act>
>     <map:serialize type="xml"/>
> </map:match>
>
>

This won't work anyway because it is syntactically incorrect.  The map:act
must contain
a complete pipeline (that's a Cocoon pipeline not a map:pipeline) and what
follows the
map:act must also be a complete pipeline (either a redirect-to, read, or
generate-transform(s)-serialize sequence.

> So I send the username and password to the Http service and get XML back
w/
> the user info if the Authentication was successful. Something like
>
> <userinfo>
> <userid>foo</userid><password>bar</password>
> <address>...</address><email>...</email>
> </userinfo>
>
> Otherwise you get an userinfo element with an error code/message in it
> <userinfo>
> <errorcode>123</errorcode>
> <errormsg>Wrong username/password, try again.</errormsg>
> </userinfo>
>
> At this point I need to store in the session the username, password,
> sessionID and a flag that proves that the authentication was successful.
It
> cannot happen in an XSP because my Authentication service is HTTP, which
> becomes a generator in my sitemap.
>
> After my generator I would like to store /userinfo/userid and
> userinfo/password in the session. So I can check is the user was
> authenticated B4 letting them go through any other pipeline.
>
> I figured SessionPropagatorAction should be the answer, but I cannot
figure
> out where and how to use it.
>
> <map:act type="session-propagator">
>       <paramater name="user" value="{/userinfo/userid}">
>       <paramater name="pwd" value="{/userinfo/password}">
> <paramater name="sessionID" value="???">
>  </map:act>
>
> Any help would be greatly appreciated.
>
> Thanks, Cocoon *Really Rocks*
>
> ./Malick.
> Malick@CoolFineNice.com
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>