[Catalyst] Using htpasswd file.
Rohan M
rohan7799 at gmail.com
Mon Apr 25 08:34:47 GMT 2011
Dear All,
I'm trying to use htpasswd file for my application for authentication. I
created htpasswd file using htpasswd command.
e.g htpasswd -c htpasswd rohan
Then I moved the file to my application directory "/home/rohanm/Apps/myapp/
But I'm getting following error when I try to authenticate user.
"Can't locate object method "get_user" via package
"Catalyst::Plugin::Authentication::Store::Htpasswd" at
/usr/local/share/perl/5.10.1/Catalyst/Authentication/Realm.pm line 123."
FYI
The myapp.pm file look like -
use Catalyst qw/
-Debug StackTrace
ConfigLoader
Static::Simple
Authentication
/;
__PACKAGE__->config('Plugin::Authentication' =3D>
{
default =3D> {
credential =3D> {
class =3D> 'Password',
password_field =3D> 'password',
password_type =3D> 'clear',
},
store =3D> {
class =3D> 'Htpasswd',
file =3D> '/home/rma/Apps/myapp/.htpasswd',
}
}
}
);
and I've a method in controller to call the authenticate function as below.
sub login : Global Form {
my ($self, $c) =3D @_;
my $form =3D $self->formbuilder;
return unless $form->submitted && $form->validate;
if($c->authenticate({username =3D> $form->field('username'),password =3D>
$form->field('password')}))
{
$c->flash->{message} =3D 'Logged in successfully.';
}
else {
$c->stash->{error} =3D 'Login failed.';
}
}
Please let me know if I'm missing on something.
Regards,
Rohan Mallelwar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110425/8ea9f=
8cd/attachment.htm
More information about the Catalyst
mailing list