apply patch from RT#102187
[catagits/Catalyst-Authentication-Store-Htpasswd.git] / README.pod
CommitLineData
e4c5ea7e 1=pod
2
3=encoding UTF-8
4
5=head1 NAME
6
7Catalyst::Authentication::Store::Htpasswd - Authen::Htpasswd based user storage/authentication
8
9=head1 VERSION
10
11version 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
46This plugin uses L<Authen::Htpasswd> to let your application use C<<.htpasswd>>
47files for it's authentication storage.
48
49=head1 METHODS
50
51=head2 new
52
53Simple constructor, dies if the htpassword file can't be found
54
55=head2 find_user
56
57Looks up the user, and returns a Catalyst::Authentication::Store::Htpasswd::User object.
58
59=head2 user_supports
60
61Delegates to L<Catalyst::Authentication::Store::Htpasswd::User->user_supports|Catalyst::Authentication::Store::Htpasswd::User#user_supports>
62
63=head2 from_session
64
65Delegates the user lookup to C<< find_user >>
66
67=head1 CONFIGURATION
68
69=head2 file
70
71The path to the htpasswd file. If the path starts with a slash, then it is assumed to be a fully
72qualified path, otherwise the path is fed through C<< $c->path_to >> and so normalised to the
73application root.
74
75Alternatively, it is possible to pass in an L<Authen::Htpasswd> object here, and this will be
76used as the htpasswd file.
77
78=head2 user_class
79
80Change the user class which this store returns. Defaults to L<Catalyst::Authentication::Store::Htpasswd::User>.
81This can be used to add additional functionality to the user class by sub-classing it, but will not normally be
82needed.
83
84=head2 user_field
85
86Change the field that the username is found in in the information passed into the call to C<< $c->authenticate() >>.
87
88This defaults to I< username >, and generally you should be able to use the module as shown in the synopsis, however
89if you need a different field name then this setting can change the default.
90
91Example:
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
104L<Authen::Htpasswd>.
105
106=head1 SUPPORT
107
108Bugs 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
111There is also a mailing list available for users of this distribution, at
112L<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst>.
113
114There is also an irc channel available for users of this distribution, at
115L<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
129David Kamholz <dkamholz@cpan.org>
130
131=item *
132
133Tomas Doran <bobtfish@bobtfish.net>
134
135=item *
136
137Karen Etheridge <ether@cpan.org>
138
139=item *
140
141Tom Bloor <t.bloor@shadowcat.co.uk>
142
143=item *
144
145Ilmari Vacklin <ilmari.vacklin@cs.helsinki.fi>
146
147=back
148
149=head1 COPYRIGHT AND LICENCE
150
151This software is copyright (c) 2005 by יובל קוג'מן (Yuval Kogman).
152
153This is free software; you can redistribute it and/or modify it under
154the same terms as the Perl 5 programming language system itself.
155
156=cut