Apache-AuthPOP3
view release on metacpan or search on metacpan
lib/Apache/AuthPOP3.pm view on Meta::CPAN
use Digest::SHA1 qw(sha1_hex);
sub handler {
my $r = shift;
$r->push_handlers(PerlAuthzHandler => \&authorize);
# check if MailHost config variable is present
return MP2 ? Apache2::Const::DECLINED() : Apache::Constants::DECLINED() unless (my $mailhost = $r->dir_config('MailHost'));
# get user's authentication credentials
my ($res, $passwd_sent) = $r->get_basic_auth_pw;
return $res if (MP2 and $res != Apache2::Const::OK() or !MP2 and $res != Apache::Constants::OK());
my $user_sent = $r->user;
my $reason = authenticate($mailhost, $user_sent, $passwd_sent);
if ($reason) {
$r->note_basic_auth_failure;
$r->log_reason($reason, $r->filename);
return MP2 ? Apache2::Const::HTTP_UNAUTHORIZED() : Apache::Constants::HTTP_UNAUTHORIZED();
}
( run in 0.330 second using v1.01-cache-2.11-cpan-4d50c553e7e )