You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jeremy Quinn <je...@media.demon.co.uk> on 2001/09/13 15:09:30 UTC

Session lost

Dear All,

I am building a little login test.
It is meaningless, because the login validation is hard-coded but it is a
handy test for me, because I am just learning ;)

Here is a snippet of my (sub) sitemap:

	<map:resources>
		<map:resource name="login-fs">
			<map:generate src="docs/framesets/login.xml"/>
			<map:transform src="stylesheets/frameset.xsl"/>
			<map:serialize/>
		</map:resource>
		<map:resource name="welcome-fs">
			<map:generate src="docs/framesets/welcome.xml"/>
			<map:transform src="stylesheets/frameset.xsl"/>
			<map:serialize/>
		</map:resource>
	</map:resources>

	<map:pipelines>
		<map:pipeline>
		<!-- / -->
			<map:match pattern="">
		    <map:redirect-to session="true" uri="welcome"/>
			</map:match>
		<!-- /welcome -->
			<map:match pattern="welcome*">
				<map:act type="session-validator">
					<map:parameter name="descriptor"
						value="context://r2r/resources/validators/login-test.xml"/>
					<map:parameter name="validate-set" value="is-logged-in"/>
					<map:redirect-to session="true" resource="welcome-fs"/>
				</map:act>
				<map:act type="form-validator">
					<map:parameter name="descriptor"
						value="context://r2r/resources/validators/login-test.xml"/>
					<map:parameter name="validate-set" value="is-logged-in"/>
					<map:act type="session-propagator">
						<map:paramater name="username" value="{../username}"/>
						<map:paramater name="password" value="{../password}"/>
					</map:act>
					<map:redirect-to session="true" resource="welcome-fs"/>
				</map:act>
				<map:redirect-to session="true" resource="login-fs"/>
			</map:match>
		</map:pipeline>
	</map:pipelines>

This is what the 'login-test.xml' file looks like:

<root>
	<parameter name="username" type="string" nullable="no"/>
	<parameter name="password" type="string" nullable="no"/>
	<constraint-set name="is-logged-in">
		<validate name="username" equals-to="jermq"/>
		<validate name="password" equals-to="blah"/>
	</constraint-set>
</root>


What happens is this:

With URL http://my.ip/c2/r2r/

	Matches "/r2r/", redirects to r2r subsitemap "/"
	Matches "/", redirects to 'welcome'
	Matches 'welcome'
		Session Validator fails (as expected)
		Form Validator fails (as expected)
		Session Propagator fails (as expected)
		Redirects to 'login-fs'
	User fills in form with 'username' and 'password'	posts to 'welcome'
	Matches 'welcome'
		Session Validator OK
		Form Validator OK
		Session Propagator OK
		Redirects to 'welcome-fs'
	I have a session cookie, I am 'logged in'

Up until now, everything has worked as expected

With URL http://my.ip/c2/r2r/welcome

	Matches "/r2r/", redirects to r2r subsitemap "/"
	Matches "/", redirects to 'welcome'
	Matches 'welcome'
		Session Validator fails (not expected)
			should have redirected to 'welcome-fs'


I appear to have lost my session parameters!
It does not report that there is no Session, only that the 'username'
parameter is now null.

Another thing, I sometimes see the session string on the URL (?), why? I
have it in the cookie ......

Can anyone explain what I am doing wrong?

thanks

regards Jeremy








-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>

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

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


Re: Session lost

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
At 2:09 PM +0100 13/9/01, Jeremy Quinn wrote:
>Dear All,
>
>I am building a little login test.
>It is meaningless, because the login validation is hard-coded but it is a
>handy test for me, because I am just learning ;)
>
>Here is a snippet of my (sub) sitemap:

[snip]

>				<map:act type="form-validator">
>					<map:parameter name="descriptor"
>						value="context://r2r/resources/validators/login-test.xml"/>
>					<map:parameter name="validate-set" value="is-logged-in"/>
>					<map:act type="session-propagator">
>						<map:paramater name="username" value="{../username}"/>
>						<map:paramater name="password" value="{../password}"/>
>					</map:act>

[snip]

OK, sorry, I worked out why it was not working

1. wrote 'paramater' instead of 'parameter', yek!
2. the expression to pick up the parameter was wrong, but I don't
understand why

	<map:parameter name="username" value="{../username}"/> did'nt work

	<map:parameter name="username" value="{username}"/> worked

which puzzled me, I thought that because the 'session-propagator' action
was nested inside the 'form-validator' I would need to access the 'parent'
Map, I thought the 'form-validator' was the one that had put the parameters
onto the Map.

regards Jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <ma...@mac.com>     		 <http://www.media.demon.co.uk>
    <phone:+44.[0].20.7737.6831>        <pa...@sms.genie.co.uk>

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

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