added version
[catagits/Catalyst-Authentication-Store-Htpasswd.git] / lib / Catalyst / Plugin / Authentication / Store / Htpasswd.pm
1 #!/usr/bin/perl
2
3 package Catalyst::Plugin::Authentication::Store::Htpasswd;
4
5 use strict;
6 use warnings;
7
8 our $VERSION = '0.01';
9
10 use Catalyst::Plugin::Authentication::Store::Htpasswd::Backend;
11
12 sub setup {
13     my $c = shift;
14
15     $c->default_auth_store(
16         Catalyst::Plugin::Authentication::Store::Htpasswd::Backend->new(
17             $c->config->{authentication}{htpasswd}
18         )
19     );
20
21         $c->NEXT::setup(@_);
22 }
23
24 __PACKAGE__;
25
26 __END__
27
28 =pod
29
30 =head1 NAME
31
32 Catalyst::Plugin::Authentication::Store::Htpasswd - Authentication
33 database in C<<$c->config>>.
34
35 =head1 SYNOPSIS
36
37     use Catalyst qw/
38       Authentication
39       Authentication::Store::Htpasswd
40       Authentication::Credential::Password
41       /;
42
43     __PACKAGE__->config->{authentication}{htpasswd} = "passwdfile";
44
45     sub login : Global {
46         my ( $self, $c ) = @_;
47
48         $c->login( $c->req->param("login"), $c->req->param("password"), );
49     }
50
51 =head1 DESCRIPTION
52
53 This plugin uses C<Authen::Htpasswd> to let your application use C<.htpasswd>
54 files for it's authentication storage.
55
56 =head1 METHODS
57
58 =head2 setup
59
60 This method will popultate C<< $c->config->{authentication}{store} >> so that
61 L<Catalyst::Plugin::Authentication/default_auth_store> can use it.
62
63 =head1 CONFIGURATION
64
65 =head2 $c->config->{authentication}{htpasswd}
66
67 The path to the htpasswd file.
68
69 =head1 AUTHORS
70
71 Yuval Kogman C<nothingmuch@woobling.org>
72
73 David Kamholz C<dkamholz@cpan.org>
74
75 =head1 SEE ALSO
76
77 L<Authen::Htpasswd>.
78
79 =head1 COPYRIGHT & LICNESE
80
81         Copyright (c) 2005 the aforementioned authors. All rights
82         reserved. This program is free software; you can redistribute
83         it and/or modify it under the same terms as Perl itself.
84
85 =cut
86
87