Commit | Line | Data |
0b5b70ba |
1 | #!/usr/bin/perl |
2 | |
e8a7c384 |
3 | package Catalyst::Plugin::Authentication::Store::Htpasswd; |
0b5b70ba |
4 | |
5 | use strict; |
6 | use warnings; |
7 | |
e8a7c384 |
8 | use Catalyst::Plugin::Authentication::Store::Htpasswd::Backend; |
0b5b70ba |
9 | |
10 | sub setup { |
11 | my $c = shift; |
12 | |
13 | $c->default_auth_store( |
e8a7c384 |
14 | Catalyst::Plugin::Authentication::Store::Htpasswd::Backend->new( |
15 | $c->config->{authentication}{htpasswd} |
0b5b70ba |
16 | ) |
17 | ); |
18 | |
19 | $c->NEXT::setup(@_); |
20 | } |
21 | |
22 | __PACKAGE__; |
23 | |
24 | __END__ |
25 | |
26 | =pod |
27 | |
28 | =head1 NAME |
29 | |
e8a7c384 |
30 | Catalyst::Plugin::Authentication::Store::Htpasswd - Authentication |
0b5b70ba |
31 | database in C<<$c->config>>. |
32 | |
33 | =head1 SYNOPSIS |
34 | |
35 | use Catalyst qw/ |
36 | Authentication |
e8a7c384 |
37 | Authentication::Store::Htpasswd |
0b5b70ba |
38 | Authentication::Credential::Password |
39 | /; |
40 | |
e8a7c384 |
41 | __PACKAGE__->config->{authentication}{htpasswd} = "..."; |
0b5b70ba |
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 | |
e8a7c384 |
51 | This plugin uses C<Apache::Htpasswd> to let your application use C<.htpasswd> |
52 | files for it's authentication storage. |
0b5b70ba |
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 | |
e8a7c384 |
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 | |
0b5b70ba |
75 | =cut |
76 | |
77 | |