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

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################

Reply via email to