[Catalyst] Weird problem with Catalyst::Authentication,
and redirects
Octavian Rasnita
orasnita at gmail.com
Wed Jan 26 13:06:33 GMT 2011
From: "David Schmidt" <davewood at gmx.at>
On Wed, Jan 26, 2011 at 12:18 PM, Ben van Staveren
<benvanstaveren at gmail.com> wrote:
> Hi Denny & list,
>
>> Have you tried turning it off and then on again? ;)
>>
> Repeatedly :)
>
>> More seriously, I have found on multiple occasions that the Catalyst
>> Auth stuff can seem to get itself into an inconsistent state, such that
>> it starts behaving oddly (usually mine will successfully log in, but
>> fail to keep track of that fact), and the only way to fix it is to
>> delete the contents of the session store (database, in my case), delete
>> all the cookies for the site, and possibly wipe the browser cache too.
>>
>> Other than that I'm not sure what to suggest. Where does the auto
>> return to? Is it possible it's coming back from there to before the
>> dashboard redirect, and so the redirect URL is getting overwritten
>> before the output is constructed? (I've not used auto, so no idea if
>> this is a stupid question or not.)
>>
> On the off-hand of being wrong, as far as I know, auto is called before
> anything else is really done, so your dispatch chain ends up going
>
> auto -> action -> end
>
> I think. Anyways, I did clear the session store, zapped all the cookies,
> and
> the behaviour's still there. I did some Data::Dumper action, and even
> after
> the RenderView action class had it's way with things, the status is still
> set to 302, a Location header is present in the output, but it did render
> the template that it's not supposed to render.
>
> Even if I do a "$c->detach('end') and return 0", it will render a
> template,
> which by all accounts, it's not supposed to be doing.
>
> Doing a telnet to the dev server and querying it does return the proper
> headers for a redirect as well; Status: 302 and Location: /login - but it
> also renders the output body, for some really freaky reason.
>
> The main issue for me is that this behaviour seems to be triggered by
> something I did in controller code somewhere, but I could swear up and
> down
> that I haven't done anything that touches even remotely near
> authentication
> or the Auth guts, so I'm totally and utterly stumped. And it's kind of
> important this works, deadlines and such things :(
If all you want to do is redirecting the user to /login if he isn't
logged in you could try CatalystX::SimpleLogin.
Using auto for that stuff is kinda deprecated according to what I
overheard in the irc channel.
I thought that CatalystX::SimpleLogin can be used only in those apps that
use HTML::FormHandler.
What's the recommended way for the apps that use HTML::FormFu if using the
auto private methods is deprecated?
Thanks.
Octavian
More information about the Catalyst
mailing list