[cgiapp] Using CAP::Authentication with multiple scripts
Cees Hek
ceeshek at gmail.com
Sun Aug 3 23:50:51 EDT 2008
On Sat, Aug 2, 2008 at 2:25 AM, Gurunandan R. Bhat
<guru at informationmatters.in> wrote:
>
> Hi,
>
> I am new to CGI::App and want to use CAP::Authentication. I have a
> couple of questions and would really appreciate some help:
>
>
> 1. I want to use CAP::Authentication::Driver::DBH. with my own
> custom run-mode that generates a login page. Is that OK?
Yes you can do that.
> 2. In my custom login page, what should I submit to?
You can submit it to any runmode in your application, because the
authentication checks happen at the prerun level. If the user isn't
authenticated, it will display your custom login page, and it can
submit to the same runmode as long as the credentials (username and
password) are also submitted. In the prerun stage, the credentials
will be checked, and if it passes, it will just continue on to display
the current runmode that you are submitting to. You can also provide
a 'destination' parameter in the submitted form, which will cause it
to redirect on success to the destination that was provided.
> 3. If I want to separate my application to different modules,
> should I have a separate login runmode in each module.
> Obviously not. So how do I organize my code to control login
> from a single point?
You generally do that by creating a base class for your application
that all your separate modules inherit from. You put the
authentication info in the base class, so all subclasses will inherit
the authentication info.
Cheers,
Cees
More information about the cgiapp
mailing list