I just recently started using CGI:App and so far, really like what I see. It is well documented, and handles most of the low-level CGI stuff that has made web programming so tedious for me (without having to learn Moose!). Most of my web app is working (I use Template Toolkit for the forms), and today I decided to add User Authentication to protect some of the runmodes. That's when the trouble began ...
I don't have any fancy needs regarding Authent. Just a simple user=>password hash will work fine. So I loaded the Generic driver. I wrote my own HTML form for the login, and call it from a "login_user()" runmode. But I can't figure out HOW to actually DO the Authentication. I try calling "verify_credentials()", but it can't find it.
I know this must be very simple and basic, but I have combed through the docs and can't find a simple explanation.
Here is my config:
package ePlan::AppBase; use strict; use warnings; use base qw(CGI::Application); use CGI::Application::Plugin::ConfigAuto (qw/cfg cfg_file/); use CGI::Application::Plugin::DBIC::Schema (qw/dbic_config schema resu +ltset rs/); use CGI::Application::Plugin::Session; use CGI::Application::Plugin::Authentication; use CGI::Application::Plugin::Authentication::Driver::Generic; my %users = ( ray => '123', jeff => '456', ); __PACKAGE__->authen->config( DRIVER => [ 'Generic', \%users ], STORE => 'Session', POST_LOGIN_URL => 'http://cgiapp.site/dash.pl', LOGIN_RUNMODE => 'login_user', LOGOUT_RUNMODE => 'logout_user', CREDENTIALS => ['authen_username','authen_password'], ); sub setup { my $self = shift; $self->start_mode('owner'); $self->run_modes('owner' => 'lookup_owner', 'user' => 'login_user', ); } sub login_user { ...... my $q = $self->query(); my $user = $q->param('authen_username'); my $pswd = $q->param('authen_password'); (now, what??) my @crednames=@{$self->authen->credentials}; # this fails --> my $go_nogo = $authen->verify_credentials();
Anyway, now whenever I get to an "authen->protected_runmode", it doesn't know I've been Authenticated, and pops up the form.
Thanks!
In reply to cgi::application authentication by neptuneray
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |