You set the authentication by stating what runmodes are protected, that is, require login, this is one way to do it, works great for me.
You do it in setup(), or you could do it in a callback- deal with that later.
Check this.. about protected runmodes
You must keep in mind that the examples on that doc, are setting the authen protected runmodes class wide, instead of instance wide. Personally I preffer to do it in the setup() phase or in a callback. Here is a convoluted example..
sub setup { my $self = shift; $self->start_mode('home'); $self->mode_param('rm'); $self->my_authen_config; } # 2 sub my_authen_config { my $self = shift; $self->authen->config( DRIVER => [ 'Generic', sub { $self->my_verify_credentials(@_) }, + ], LOGIN_SESSION_TIMEOUT => $LOGIN_SESSION_TIMEOUT, CREDENTIALS => ['authen_username', 'authen_password' ], STORE => 'Session', LOGIN_RUNMODE => 'login', ); $self->authen->protected_runmodes(qr/^(?!_?log)/); $self->authen; } sub my_verify_credentials { my $self = shift; my ($username,$password)= @_; ($username and $password ) or $self->feedback("Missing username or password.") and return; $self->my_method_for_password_test( $username, $password) or $self->feedback("Wrong username or password.") and return; return $username; }
(keep in mind this code is not fully functional by itself)
In reply to Re: cgi::application authentication
by leocharre
in thread cgi::application authentication
by neptuneray
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |