HTTP::AppServer::Plugin::HTTPAuth - Plugin for HTTP::AppServer uses HTTP authentication to authenticate a client. The authentication works based on a certain handler regex.
use HTTP::AppServer; my $server = HTTP::AppServer->new(); $server->plugin('HTTPAuth', Logins => {guest => '', mrx => 'pass'}, URLs => ['^\/admin']);
Plugin for HTTP::AppServer uses HTTP authentication to authenticate a client. The authentication works based on a certain handler regex.
A hash containing the available accounts that are allowed to access the restricted URLs, e.g.:
..., Logins => {guest => '', mrx => 'pass'}, ...
This is a list of restricted URLs. When an URL is accessed that matches any regular expression in this list, a HTTP authorization is preformed. If the authorization fails an error page is returned. In all other cases (URL not restricted or authorization was successful) other handlers are allowed to process the URL.
This can be supplied additionally to the Logins option. The account information is then read from a file that has the format of normal .htpasswd files, e.g.
username1:password username2:password ...
while password is a Base64 encoded password.
HTTPAuth installs a binding to the URL '^(.*)$', which means it matches everything. It allows for further processing after that if the URL is not restricted (is not contained in the URLs option when loading the plugin).
This is a reference to the Logins that are configured when loading the plugin.
This is a reference to the URLs that are configured when loading the plugin.
None.
HTTP::AppServer, HTTP::AppServer::Plugin
Tom Kirchner, <tom@tkirchner.com>
Copyright (C) 2010 by Tom Kirchner
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.
To install HTTP::AppServer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTTP::AppServer
CPAN shell
perl -MCPAN -e shell install HTTP::AppServer
For more information on module installation, please visit the detailed CPAN module installation guide.