3 package Catalyst::Plugin::Authentication::Store::Htpasswd::Backend;
4 use base qw/Class::Accessor::Fast/;
10 use Catalyst::Plugin::Authentication::Store::Htpasswd::User;
12 BEGIN { __PACKAGE__->mk_accessors(qw/file/) }
15 my ( $class, $file, %extra ) = @_;
17 bless { file => ( ref $file ? $file : Authen::Htpasswd->new($file, \%extra) ) }, $class;
21 my ( $self, $id ) = @_;
22 Catalyst::Plugin::Authentication::Store::Htpasswd::User->new( $self->file->lookup_user($id) );
28 # this can work as a class method
29 Catalyst::Plugin::Authentication::Store::Htpasswd::User->supports(@_);
40 Catalyst::Plugin::Authentication::Store::Htpasswd::Backend - Htpasswd
41 authentication storage backend.
45 # you probably just want Store::Htpasswd under most cases,
46 # but if you insist you can instantiate your own store:
48 use Catalyst::Plugin::Authentication::Store::Htpasswd::Backend;
52 Authentication::Credential::Password
56 user => { password => "s3cr3t" },
59 our $users = Catalyst::Plugin::Authentication::Store::Htpasswd::Backend->new(\%users);
62 my ( $self, $c ) = @_;
64 $c->login( $users->get_user( $c->req->param("login") ),
65 $c->req->param("password") );
70 You probably want L<Catalyst::Plugin::Authentication::Store::Htpasswd>, unless
71 you are mixing several stores in a single app and one of them is Htpasswd.
73 Otherwise, this lets you create a store manually.
81 Constructs a new store object, which uses the supplied hash ref as it's backing
86 Keys the hash by $id and returns the value.
88 If the return value is unblessed it will be blessed as
89 L<Catalyst::Plugin::Authentication::User::Hash>.
93 Chooses a random user from the hash and delegates to it.