htpasswd backend works
[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 use Catalyst::Plugin::Authentication::Store::Htpasswd::Backend;
9
10 sub setup {
11     my $c = shift;
12
13     $c->default_auth_store(
14         Catalyst::Plugin::Authentication::Store::Htpasswd::Backend->new(
15             $c->config->{authentication}{htpasswd}
16         )
17     );
18
19         $c->NEXT::setup(@_);
20 }
21
22 __PACKAGE__;
23
24 __END__
25
26 =pod
27
28 =head1 NAME
29
30 Catalyst::Plugin::Authentication::Store::Htpasswd - Authentication
31 database in C<<$c->config>>.
32
33 =head1 SYNOPSIS
34
35     use Catalyst qw/
36       Authentication
37       Authentication::Store::Htpasswd
38       Authentication::Credential::Password
39       /;
40
41     __PACKAGE__->config->{authentication}{htpasswd} = "...";
42
43     sub login : Global {
44         my ( $self, $c ) = @_;
45
46         $c->login( $c->req->param("login"), $c->req->param("password"), );
47     }
48
49 =head1 DESCRIPTION
50
51 This plugin uses C<Apache::Htpasswd> to let your application use C<.htpasswd>
52 files for it's authentication storage.
53
54 =head1 METHODS
55
56 =over 4
57
58 =item 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 =back
64
65 =head1 CONFIGURATION
66
67 =over 4
68
69 =item $c->config->{authentication}{htpasswd}
70
71 The path to the htpasswd file.
72
73 =back
74
75 =cut
76
77