Apache2-AuthEnv
view release on metacpan or search on metacpan
lib/Apache2/AuthEnv.pm view on Meta::CPAN
###################### Directives ###########################################
# Set the environment variable to use for authentication
# and set the system to authenticate and authorise.
sub AuthEnvUser
{
my ($cfg, $parms, $fmt, @args) = @_;
my $line = join(':', $parms->directive->filename, $parms->directive->line_num);
# Check that the format contains something to expand.
# Warn if it's fixed.
unless ($fmt =~ /%\{.*\}/)
{
# NB the request object is not available when called in
# global config files (eg httpd.conf).
err("AuthEnvUser format '$fmt' has no expansion at $line");
#return Apache2::Const::HTTP_FORBIDDEN;
}
lib/Apache2/AuthEnv.pm view on Meta::CPAN
# Run though each environment valriable in turn.
for my $e (split(/\|/, $fmt))
{
# return value if it exists.
return $r->subprocess_env($e) if defined($r->subprocess_env($e));
}
# Otherwise return the default value.
return $default if defined $default;
info "Failed to expand '$fmt' for URL ", $r->uri;
# Failed.
$$fail++;
'';
}
# Look a key up in the MLDBM database, with a function that can be cached.
sub dblookup2
{
lib/Apache2/AuthEnv.pm view on Meta::CPAN
else
{
# info off
no warnings;
eval 'sub debug { 1; };';
}
# Import CGI environment.
$r->subprocess_env unless $r->is_perl_option_enabled('SetupEnv');
# expand $AuthEnvUser format; fail if a variable doesn't
# not exist.
# Check that AuthEnvUser is set.
return Apache2::Const::HTTP_UNAUTHORIZED unless exists $cfg->{AuthEnvUser};
# Set the AE version environment.
$r->subprocess_env('HTTP_AE_VERSION', $VERSION);
# Set the environment and the REMOTE_USER along the way.
for my $s (@{$cfg->{set}})
( run in 0.601 second using v1.01-cache-2.11-cpan-5623c5533a1 )