[cgiapp] CAP::Authorization, CAP::AutoRunmode & CA::Dispatch

Richard Jones ra.jones at dpw.clara.co.uk
Tue Aug 11 05:52:51 EDT 2009


Am having some difficulty with the FORBIDDEN_RUNMODE param when using 
CAP::Authorization with CA::Dispatch. All my application classes inherit 
from a base class where I have defined the 'forbidden' runmode (using 
AutoRunmode syntax). But declaring FORBIDDEN_RUNMODE => 'forbidden' in 
authz->config() means that for some reason the classes loaded by 
CA::Dispatch - which all 'use base MyApp::Base' - can't find the 
forbidden() rm so return my error page instead.

So I looked at the documentation and found the CALLBACKS section, and 
wondered what would happen if I defined the authz_forbidden runmode in 
cgiapp_prerun() instead of using FORBIDDEN_RUNMODE in the config:

   $self->run_modes( authz_forbidden => 'forbidden' );

and this actually works, even though I'm using a version 4.xx 
CGI::Application - I get my forbidden() output rather than the error 
page. But is this the right way to use CAP::Authorization in this
situation? Should I expect CAP::Auth to work out-of-the-box with 
CA::Dispatch?
-- 
Richard Jones


More information about the cgiapp mailing list