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 : Apache::Htpasswd->new($file, @extra) ) },
22 my ( $self, $id ) = @_;
23 Catalyst::Plugin::Authentication::Store::Htpasswd::User->new( $id,
30 # this can work as a class method
31 Catalyst::Plugin::Authentication::Store::Htpasswd::User->supports(@_);
42 Catalyst::Plugin::Authentication::Store::Htpasswd::Backend - Htpasswd
43 authentication storage backend.
47 # you probably just want Store::Htpasswd under most cases,
48 # but if you insist you can instantiate your own store:
50 use Catalyst::Plugin::Authentication::Store::Htpasswd::Backend;
54 Authentication::Credential::Password
58 user => { password => "s3cr3t" },
61 our $users = Catalyst::Plugin::Authentication::Store::Htpasswd::Backend->new(\%users);
64 my ( $self, $c ) = @_;
66 $c->login( $users->get_user( $c->req->param("login") ),
67 $c->req->param("password") );
72 You probably want L<Catalyst::Plugin::Authentication::Store::Htpasswd>, unless
73 you are mixing several stores in a single app and one of them is Htpasswd.
75 Otherwise, this lets you create a store manually.
83 Constructs a new store object, which uses the supplied hash ref as it's backing
88 Keys the hash by $id and returns the value.
90 If the return value is unblessed it will be blessed as
91 L<Catalyst::Plugin::Authentication::User::Hash>.
95 Chooses a random user from the hash and delegates to it.