NAME

HTTP::AppServer::Plugin::HTTPAuth - Plugin for HTTP::AppServer uses HTTP authentication to authenticate a client. The authentication works based on a certain handler regex.

SYNOPSIS

use HTTP::AppServer;
my $server = HTTP::AppServer->new();
$server->plugin('HTTPAuth', Logins => {guest => '', mrx => 'pass'}, URLs => ['^\/admin']);

DESCRIPTION

Plugin for HTTP::AppServer uses HTTP authentication to authenticate a client. The authentication works based on a certain handler regex.

Plugin configuration

Logins => hash

A hash containing the available accounts that are allowed to access the restricted URLs, e.g.:

..., Logins => {guest => '', mrx => 'pass'}, ...

URLs => array

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.

LoginsFile => filename

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.

Installed URL handlers

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).

Installed server properties

httpauth_logins

This is a reference to the Logins that are configured when loading the plugin.

httpauth_urls

This is a reference to the URLs that are configured when loading the plugin.

Installed server methods

None.

SEE ALSO

HTTP::AppServer, HTTP::AppServer::Plugin

AUTHOR

Tom Kirchner, <tom@tkirchner.com>

COPYRIGHT AND LICENSE

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.