So here comes the most actual code:
Submitting it to CPAN would be fine!
------------------------------------------------
package Apache::AuthMulti;
# Stathy G. Touloumis
# Marcel M. Weber
# Darren Chamberlain
#
# Version 0.01-2 / 13.02.2002 / Marcel M. Weber
use strict;
use Apache::Constants qw(:common);
sub handler {
my $r = shift;
my($res, $sent_pw) = $r->get_basic_auth_pw;
return $res if $res != OK;
my @auth_modules=$r->dir_config->get("AuthModules");
for my $am (@auth_modules)
{
load($am);
if ($@){
$r->log_reason("Error loading module '$am':$@");
next;
}
my $handler = $am->can('handler') or next;
if ($handler->($r) == OK) {
$r->warn("$am return OK");
return OK;
}
$r->log_reason("$am not OK");
}
$r->note_basic_auth_failure;
$r->log_reason("none of the handlers could authenticate this
user");
return AUTH_REQUIRED;
}
sub load {
my $module=@_[0];
$module =~ s[::][$Config{'path_sep'}]go;
$module .= '.pm';
eval { require $module; };
return $@ ? 1 : 0;
}
1;
__END__
-----------------------------------------------------------------------------
Am Mittwoch den, 13. Februar 2002, um 21:42, schrieb Stathy G. Touloumis:
>
>
>>> I would suggest changing the PerlSetVar variables
>>> to actual apache configuration directives which would change this :
>>>
>>> my @auth_modules=$r->dir_config->get("AuthModules");
>>>
>>> I don't have an immediate patch for this but have done it before.
>>> If you would like me to work on this code no prob, otherwise check
>>> the eagle book for some samples if unfamiliar.
>>
>> *nod* I'm not sure that the syntax would work; $r->dir_config()
>> would probably return an arrayref, and such; this needs to be
>> tested.
>
It returns a arrayref, as far as I experienced. Well I'm really new to
mod_perl
and my eagle book waits still in the library to be bought... But why is
this
version not nice?
-------------------
Marcel
PGP / GPG Key: http://www.ncpro.com/GPG/mmweber-at-ncpro-com.asc