Thanks for the help Doug. This is what I have now but all I get is a
segementation fault in the log.
Any ideas?
-Todd
package Apache::SetRealm;
## Usage: PerlHeaderParserHandler Apache::SetRealm
use strict;
use Apache::Constants qw(:common);
sub handler {
my $r = shift;
# find the name of the realm
# if realm does not exist error
# else see if Auth header set
# if auth header not set return AUTH_REQUIRED
# else return OK
# If Auth header is set a future PerlAuthenHandler will check the
password.
# When that happens we can't use get_basic_auth_info because AuthName is
# not set in the config file. We will have to parse the Auth header manually.
# The realm will be determined from path_info.
return OK if $r->header_in('Authorization');
my $realm = get_realm($r);
# Prompt for authentication info in the proper realm
$r->auth_name($realm);
$r->note_basic_auth_failure;
return AUTH_REQUIRED;
}
sub get_realm {
## Get the AuthName for a specific uri. You can probably read these off of a file
that ## contains a list of uri's and realmNames
my $r = shift;
$r->uri =~ /\/modperl\/(.*)/;
return $1 if $1;
return "Top Level";
}
1;