apply patch from RT#102187
[catagits/Catalyst-Authentication-Store-Htpasswd.git] / README.pod
1 =pod
2
3 =encoding UTF-8
4
5 =head1 NAME
6
7 Catalyst::Authentication::Store::Htpasswd - Authen::Htpasswd based user storage/authentication
8
9 =head1 VERSION
10
11 version 1.005
12
13 =head1 SYNOPSIS
14
15     use Catalyst qw/
16       Authentication
17     /;
18
19     __PACKAGE__->config(
20         authentication => {
21             default_realm => 'test',
22             realms => {
23                 test => {
24                     credential => {
25                         class          => 'Password',
26                         password_field => 'password',
27                         password_type  => 'self_check',
28                     },
29                     store => {
30                         class => 'Htpasswd',
31                         file => 'htpasswd',
32                     },
33                 },
34             },
35         },   
36     );
37
38     sub login : Global {
39         my ( $self, $c ) = @_;
40
41         $c->authenticate({ username => $c->req->param("login"), password => $c->req->param("password") });
42     }
43
44 =head1 DESCRIPTION
45
46 This plugin uses L<Authen::Htpasswd> to let your application use C<<.htpasswd>>
47 files for it's authentication storage.
48
49 =head1 METHODS
50
51 =head2 new
52
53 Simple constructor, dies if the htpassword file can't be found
54
55 =head2 find_user
56
57 Looks up the user, and returns a Catalyst::Authentication::Store::Htpasswd::User object.
58
59 =head2 user_supports
60
61 Delegates to L<Catalyst::Authentication::Store::Htpasswd::User->user_supports|Catalyst::Authentication::Store::Htpasswd::User#user_supports>
62
63 =head2 from_session
64
65 Delegates the user lookup to C<< find_user >>
66
67 =head1 CONFIGURATION
68
69 =head2 file
70
71 The path to the htpasswd file. If the path starts with a slash, then it is assumed to be a fully
72 qualified path, otherwise the path is fed through C<< $c->path_to >> and so normalised to the 
73 application root.
74
75 Alternatively, it is possible to pass in an L<Authen::Htpasswd> object here, and this will be
76 used as the htpasswd file.
77
78 =head2 user_class
79
80 Change the user class which this store returns. Defaults to L<Catalyst::Authentication::Store::Htpasswd::User>.
81 This can be used to add additional functionality to the user class by sub-classing it, but will not normally be
82 needed.
83
84 =head2 user_field
85
86 Change the field that the username is found in in the information passed into the call to C<< $c->authenticate() >>.
87
88 This defaults to I< username >, and generally you should be able to use the module as shown in the synopsis, however
89 if you need a different field name then this setting can change the default.
90
91 Example:
92
93     __PACKAGE__->config( authentication => { realms => { test => {
94                     store => {
95                         class => 'Htpasswd',
96                         user_field => 'email_address',
97                     },
98     }}});
99     # Later in your code
100     $c->authenticate({ email_address => $c->req->param("email"), password => $c->req->param("password") });
101
102 =head1 SEE ALSO
103
104 L<Authen::Htpasswd>.
105
106 =head1 SUPPORT
107
108 Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Authentication-Store-Htpasswd>
109 (or L<bug-Catalyst-Authentication-Store-Htpasswd@rt.cpan.org|mailto:bug-Catalyst-Authentication-Store-Htpasswd@rt.cpan.org>).
110
111 There is also a mailing list available for users of this distribution, at
112 L<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst>.
113
114 There is also an irc channel available for users of this distribution, at
115 L<C<#catalyst> on C<irc.perl.org>|irc://irc.perl.org/#catalyst>.
116
117 =head1 AUTHOR
118
119 יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
120
121 =head1 CONTRIBUTORS
122
123 =for stopwords David Kamholz Tomas Doran Karen Etheridge Tom Bloor Ilmari Vacklin
124
125 =over 4
126
127 =item *
128
129 David Kamholz <dkamholz@cpan.org>
130
131 =item *
132
133 Tomas Doran <bobtfish@bobtfish.net>
134
135 =item *
136
137 Karen Etheridge <ether@cpan.org>
138
139 =item *
140
141 Tom Bloor <t.bloor@shadowcat.co.uk>
142
143 =item *
144
145 Ilmari Vacklin <ilmari.vacklin@cs.helsinki.fi>
146
147 =back
148
149 =head1 COPYRIGHT AND LICENCE
150
151 This software is copyright (c) 2005 by יובל קוג'מן (Yuval Kogman).
152
153 This is free software; you can redistribute it and/or modify it under
154 the same terms as the Perl 5 programming language system itself.
155
156 =cut