You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Antonio Gallardo <ag...@agsoftware.dnsalias.com> on 2003/11/25 14:37:32 UTC

[Flow+Auth-fw+woody] cocoon.redirectTo() not working after successful authentication

Hi:

I am 3 days on this problem. I posted on the user list but no one answer
my mail. :(

I am trying to use the authentication-fw without any action, just flow and
woody. I already turned on every posible log avaliable in logkit. I even
inserted some log lines inside the auth.js. The problem I have is:

After succesful authenticated user, the function success may redirect to
the welcome page. But it does not doing it. Interesting enough is that I
can see in the core.log the sucessful authentication:

DEBUG   (2003-11-25) 07:21.19:254   [core.authentication-manager]
(/ait/7b38360f3e8c4476831135763988660d5d826b4b.continue)
http8080-Processor4/PipelineAuthenticator: END
isValidAuthenticationFragment valid=true
INFO    (2003-11-25) 07:21.19:255   [core.authentication-manager]
(/ait/7b38360f3e8c4476831135763988660d5d826b4b.continue)
http8080-Processor4/PipelineAuthenticator: Authenticator: User
authenticated using handler 'authhandler'
DEBUG   (2003-11-25) 07:21.19:260   [core.authentication-manager]
(/ait/7b38360f3e8c4476831135763988660d5d826b4b.continue)
http8080-Processor4/PipelineAuthenticator: end authenticator

And you see there is not a redirectTo() command. It is simply "losed"
somewhere. In the flow.log I cleare can see:

INFO    (2003-11-25) 07:21.19:307   [flow]
(/ait/7b38360f3e8c4476831135763988660d5d826b4b.continue)
http8080-Processor4/FOM_Cocoon$FOM_Log: success: internal - undefined
INFO    (2003-11-25) 07:21.19:307   [flow]
(/ait/7b38360f3e8c4476831135763988660d5d826b4b.continue)
http8080-Processor4/FOM_Cocoon$FOM_Log: success: redirect -
/ait/bienvenidos

So the redirect must go to the /ait/bienvenidos page, but there is no
another redirection. Even in the sitemap.log I got:

INFO    (2003-11-25) 07:21.19:308   [sitemap]
(/ait/7b38360f3e8c4476831135763988660d5d826b4b.continue)
http8080-Processor4/ForwardRedirector: Redirecting to '/ait/bienvenidos'

But then no other log.
The same happen if the authentication fail.

I guess there is a problem in the treeprocessor. How many times we can
redirect inside a processing request without having any problem? Please
note the authentication-fw trig in the middle of the flow his own internal
validation

Can someone tell me if it can work at all? Someone already tried to do it?

Please help.

Best Regards,

Antonio Gallardo

Re: [Flow+Auth-fw+woody] cocoon.redirectTo() not working after

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
Hi Upayavira:

Thanks for your reply. It is good to know I am the first in this untested
area. Sometimes it is good to speak with a friend about the problem and
show them why it does not work. That way you come with new ideas. And if
you are lucky, you solve the problem.

It is working now! :-DDDDD

Best Regards,

Antonio Gallardo


Re: [Flow+Auth-fw+woody] cocoon.redirectTo() not working after

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On 25 Nov 2003, at 14:35, Jeremy Quinn wrote:

> As an aside ..... I have found situations whereby cocoon.redirectTo 
> ("blah") does AbsolutelyNothing™, for no good reason .... a bit 
> disturbing (!!!)
>

Here is a script example where cocoon.redirectTo does nothing (for 
reasons I do not understand).
Click the 'Done' button with the script below and you get a blank page :

function updateAlbum (form) {
	var factory = cocoon.getComponent (PersistanceFactory.ROLE);
	var session = factory.createSession ();
	var userid = cocoon.parameters["userid"];
	var screen = cocoon.parameters["screen"];
	var album = AlbumPeer.load (session, new java.lang.Long 
(cocoon.parameters["assetid"]), null);
	if (album != null) {
		if (album.user.id.toString ().equals (userid)) {
			try {
				while (true) { // stay in the form until they click 'cancel' or 
'done'
					form.load (album);
					session.close();
					form.showForm (screen);
					if ("cancel".equals (form.submitId)) {
						cocoon.sendPage ("screen/cancel", {message: 
"myalbums.cancel.update"});
						break;
					}
					session = factory.createSession ();
					form.save (album);
					if (!AlbumPeer.save (session, album)) {
						cocoon.log.error ("error while saving album: " + album.getTitle 
());
						cocoon.sendPage ("screen/error", {message: 
"myalbums.album.saveerror"});
						break; // Transaction already rolled-back
					}
					if ("done".equals (form.submitId)) {
						cocoon.redirectTo ("index"); // FAILS !!
						break;
					}
				} // end while
			} catch (e) {
				cocoon.log.error (e);
				cocoon.sendPage ("screen/error", {message: e});
			} finally {
				session.close ();
				cocoon.releaseComponent (factory);
			}
		} else {
			cocoon.sendPage ("screen/error", {message: 
"myalbums.album.notyours"});
		}
	} else {
		cocoon.sendPage ("screen/error", {message: 
"myalbums.album.notavailable"});
	}
}

Any ideas anyone?

thanks

regards Jeremy

Re: [Flow+Auth-fw+woody] cocoon.redirectTo() not working after

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On 25 Nov 2003, at 13:44, Upayavira wrote:

> Antonio,
>
> I cannot give you a full answer, just tell you the status of the flow 
> code within the authentication framework.
>
> Carsten created an empty js file, which I completed. I have not since 
> used the auth-fw in flow, and, as far as I know, you are the first to 
> try.

I am successfully using a modified version of auth-fw with flow, using 
Woody for the forms and Hibernate to retrieve Users for the 
authentication.

The major problem I have is that if I attempt to use a flow pipeline to 
provide the (internally called) 'authenticate' pipeline, by the time 
control returns to my 'do-login' flowscript, a load of the cocoon 
object properties are null (ugh!!!), I had to resort to using a 
modified version of Hugo's AuthenticationGenerator (thanks Hugo!).

I have tried long and hard to work out what is going wrong, but no luck 
so far.

As an aside ..... I have found situations whereby cocoon.redirectTo 
("blah") does AbsolutelyNothing™, for no good reason .... a bit 
disturbing (!!!)


regards Jeremy

Re: [Flow+Auth-fw+woody] cocoon.redirectTo() not working after

Posted by Upayavira <uv...@upaya.co.uk>.
Antonio,

I cannot give you a full answer, just tell you the status of the flow 
code within the authentication framework.

Carsten created an empty js file, which I completed. I have not since 
used the auth-fw in flow, and, as far as I know, you are the first to try.

I know that I got it working within a sample, but that is as far as I went.

Now that I am getting on to developing my application for which I 
originally started that auth-fw work, I have started to wonder about the 
need for the auth-fw within a woody/flow solution.

It seems to me that the auth-fw is a decent implementation that is very 
much built around a pipelined system, whereas flow gives us a 
programmatic metaphor too.

I am therefore planning to create my own simple authentication framework 
in Java that stores its info in simple XML files. I cannot see that this 
is any harder than building the pipelines that I would have to write, 
especially when it comes to creating and registering new users.

Sorry if this doesn't give you a direct answer to your problem, but 
hopefully it gives you some background to the auth-fw with flow.

Regards, Upayavira



Antonio Gallardo wrote:

>Hi:
>
>I am 3 days on this problem. I posted on the user list but no one answer
>my mail. :(
>
>I am trying to use the authentication-fw without any action, just flow and
>woody. I already turned on every posible log avaliable in logkit. I even
>inserted some log lines inside the auth.js. The problem I have is:
>
>After succesful authenticated user, the function success may redirect to
>the welcome page. But it does not doing it. Interesting enough is that I
>can see in the core.log the sucessful authentication:
>
>DEBUG   (2003-11-25) 07:21.19:254   [core.authentication-manager]
>(/ait/7b38360f3e8c4476831135763988660d5d826b4b.continue)
>http8080-Processor4/PipelineAuthenticator: END
>isValidAuthenticationFragment valid=true
>INFO    (2003-11-25) 07:21.19:255   [core.authentication-manager]
>(/ait/7b38360f3e8c4476831135763988660d5d826b4b.continue)
>http8080-Processor4/PipelineAuthenticator: Authenticator: User
>authenticated using handler 'authhandler'
>DEBUG   (2003-11-25) 07:21.19:260   [core.authentication-manager]
>(/ait/7b38360f3e8c4476831135763988660d5d826b4b.continue)
>http8080-Processor4/PipelineAuthenticator: end authenticator
>
>And you see there is not a redirectTo() command. It is simply "losed"
>somewhere. In the flow.log I cleare can see:
>
>INFO    (2003-11-25) 07:21.19:307   [flow]
>(/ait/7b38360f3e8c4476831135763988660d5d826b4b.continue)
>http8080-Processor4/FOM_Cocoon$FOM_Log: success: internal - undefined
>INFO    (2003-11-25) 07:21.19:307   [flow]
>(/ait/7b38360f3e8c4476831135763988660d5d826b4b.continue)
>http8080-Processor4/FOM_Cocoon$FOM_Log: success: redirect -
>/ait/bienvenidos
>
>So the redirect must go to the /ait/bienvenidos page, but there is no
>another redirection. Even in the sitemap.log I got:
>
>INFO    (2003-11-25) 07:21.19:308   [sitemap]
>(/ait/7b38360f3e8c4476831135763988660d5d826b4b.continue)
>http8080-Processor4/ForwardRedirector: Redirecting to '/ait/bienvenidos'
>
>But then no other log.
>The same happen if the authentication fail.
>
>I guess there is a problem in the treeprocessor. How many times we can
>redirect inside a processing request without having any problem? Please
>note the authentication-fw trig in the middle of the flow his own internal
>validation
>
>Can someone tell me if it can work at all? Someone already tried to do it?
>
>Please help.
>
>Best Regards,
>
>Antonio Gallardo
>
>  
>



Re: [Flow+Auth-fw+woody] cocoon.redirectTo() not working after successful authentication

Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
Hi:

Related to the problem I found an interesting log inside the core.log:

After

DEBUG   (2003-11-25) 07:20.58:913   [core] (/ait/bienvenidos)
http8080-Processor4/Cocoon: DEBUGGING INFORMATION:

REQUEST: /ait/bienvenidos

CONTEXT PATH: /ait
SERVLET PATH: /bienvenidos
PATH INFO: null

REMOTE HOST: 10.0.0.5
REMOTE ADDRESS: 10.0.0.5
REMOTE USER: null
REQUEST SESSION ID: 23E35D2C5CA95DD96145CA878DFC6CA7

########################(PLEASE NOTE THE ABOVE SESSION ID)################

then there is:

HEADER PARAMETERS:
... some attributes ...

PARAM: 'cookie' VALUES: '[JSESSIONID=23E35D2C5CA95DD96145CA878DFC6CA7;
nde-textsize=16px; SQMSESSID=f439f40a5ffa832c975d17cc1dce6bdd;
JSESSIONID=35488D58EBDB6ABEA4D3A4B253B3AFEC; testing=1;
sid=22f8356d85c439959d82e2b4e4155f05]'

SESSION ATTRIBUTES:


#########################################

There are not session attributes. I think it is OK. But maybe the 2
JSESSIONID in the cookie paramaters can create the problem?

Best Regards,

Antonio Gallardo