From b7cb4fdb82c69ef990c86cee8ec892c370affa0f Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 1 Sep 2010 23:16:25 -0500 Subject: add some docs --- lib/Plack/Middleware/Auth/Htpasswd.pm | 64 +++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'lib/Plack/Middleware/Auth') diff --git a/lib/Plack/Middleware/Auth/Htpasswd.pm b/lib/Plack/Middleware/Auth/Htpasswd.pm index 2f9d949..ff46005 100644 --- a/lib/Plack/Middleware/Auth/Htpasswd.pm +++ b/lib/Plack/Middleware/Auth/Htpasswd.pm @@ -9,6 +9,57 @@ use Authen::Htpasswd; use MIME::Base64; use Path::Class (); +# ABSTRACT: http basic authentication through apache-style .htpasswd files + +=head1 SYNOPSIS + + use Plack::Builder; + my $app = sub { ... }; + + builder { + enable "Auth::Htpasswd", file => '/path/to/.htpasswd'; + $app; + }; + +or + + builder { + enable "Auth::Htpasswd", file_root => '/path/to/my/static/files'; + $app; + }; + +=head1 DESCRIPTION + +This middleware enables HTTP Basic authenication, based on the users in an +L. +You can either specify the file directly, through the C option, or use +the C option to specify the root directory on the filesystem that +corresponds to the web application root. This second option is more useful when +using an app that is closely tied to the filesystem, such as +L. If C is used, the requested path will be +inspected, and a file named C<.htpasswd> will be checked in each containing +directory, up to the C. The first one found will be used to validate +the requested user. + +=head1 CONFIGURATION + +=head2 file + +Name of a .htpasswd file to read authentication information from. Required if +C is not set. + +=head2 file_root + +Path to the on-disk directory that corresponds to the root URL path of the app. +Required C is not set, and ignored if C is set. + +=head2 realm + +Realm name to display in the basic authentication dialog. Defaults to +'restricted area'. + +=cut + sub prepare_app { my $self = shift; die "must specify either file or file_root" @@ -81,4 +132,17 @@ sub unauthorized { ]; } +=head1 SEE ALSO + +L + +L + +=head1 CREDITS + +Large parts of this code were modeled after (read: stolen from) +L by Tatsuhiko Miyagawa. + +=cut + 1; -- cgit v1.2.3-54-g00ecf