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, $self->file->lookup_user($id) );
28 # this can work as a class method
29 Catalyst::Plugin::Authentication::Store::Htpasswd::User->supports(@_);
33 my ( $self, $c, $id ) = @_;
34 $self->get_user( $id );
45 Catalyst::Plugin::Authentication::Store::Htpasswd::Backend - Htpasswd
46 authentication storage backend.
50 # you probably just want Store::Htpasswd under most cases,
51 # but if you insist you can instantiate your own store:
53 use Catalyst::Plugin::Authentication::Store::Htpasswd::Backend;
57 Authentication::Credential::Password
61 user => { password => "s3cr3t" },
64 our $users = Catalyst::Plugin::Authentication::Store::Htpasswd::Backend->new(\%users);
67 my ( $self, $c ) = @_;
69 $c->login( $users->get_user( $c->req->param("login") ),
70 $c->req->param("password") );
75 You probably want L<Catalyst::Plugin::Authentication::Store::Htpasswd>, unless
76 you are mixing several stores in a single app and one of them is Htpasswd.
78 Otherwise, this lets you create a store manually.
84 Constructs a new store object, which uses the supplied hash ref as it's backing
89 Keys the hash by $id and returns the value.
91 If the return value is unblessed it will be blessed as
92 L<Catalyst::Plugin::Authentication::User::Hash>.
96 Chooses a random user from the hash and delegates to it.
98 =head1 COPYRIGHT & LICENSE
100 Copyright (c) 2005 the aforementioned authors. All rights
101 reserved. This program is free software; you can redistribute
102 it and/or modify it under the same terms as Perl itself.