[cgiapp] CAP::Authentication, CA::Dispatch and CA::Server
Richard Jones
ra.jones at dpw.clara.co.uk
Wed Nov 5 06:25:23 EST 2008
Anyone managing to get CAP::Authentication, CA::Dispatch and CA::Server
working together?
In cgiapp_init:
$self->authen_config(
....
LOGIN_URL => '/app/login', # CA::Server sends /app/* to Dispatch
);
Then in cgiapp_prerun:
$self->authen->username ?
$self->authen->redirect_after_login :
$self->authen->redirect_to_login;
In the case of a non-logged in user, this causes a redirection loop :
'Redirection limit for this URL exceeded. Unable to load the requested
page. The site is redirecting the request in a way that will never
complete.'
Using LOGIN_URL => '/login' (or 'login') gets over the redirect problem,
but causes the address to switch to localhost:8080/login which is not a
recognised app for CA::Server, unless I make it so, then we get the
redirection loop again.
Using LOGIN_URL => '' (or no LOGIN_URL defined) loads the default login
box and works fine, and re-directs to the Dispatch default page after login.
Switching to LOGIN_RUNMODE instead of LOGIN_URL causes the app to load
the AUTOLOAD => \&_exception page - ie it can't find the runmode
'login', yet login() is the defined StartRunmode (using
CAP::AutoRunmode) in the base app. module.
And if I replace $self->authen->redirect_to_login with
$self->forward('login') it works fine, provided LOGIN_RUNMODE =>
'login', otherwise I get the default login page.
So it looks like the LOGIN_URL/LOGIN_RUNMODE and redirect_to_login()
functions aren't working with CA::Dispatch. Unfortunately the default
login box is not an option as I *need* to use a custom login page.
I can't see where I've gone wrong since the default behaviour displaying
the default login page seems to work OK. Presumably I've mis-configured
CAP::Authen or CA::Dispatch somewhere?
--
Richard Jones
More information about the cgiapp
mailing list