PerlRequire /etc/httpd/conf/perl/startup.pl
PerlModule MyApache2::Authm
<Location "/git">
AuthType Basic
SetHandler perl-script
PerlAuthenHandler MyApache2::Authm::authn_handler
AuthName "My Git Repository"
AuthBasicProvider ldap-ny ldap-mia
AuthzLDAPAuthoritative off
AuthGroupFile /git/htgroups
Require valid-user
</Location>
package MyApache2::Authm;
use warnings;
use Apache2::Access ();
use Apache2::RequestRec ();
use Apache2::Const -compile => qw(OK DECLINED HTTP_UNAUTHORIZED);
sub authn_handler
{
my $r = shift;
#Get Authentication Credentials
my ($res, $sent_pw) = $r->get_basic_auth_pw;
if ($r->user =~ m/^(\QDOMAIN\\\E)/)
{
my @user = split(/\\/,$r->user);
$r->user($user[1]);
print "User: ", $r->user;
return Apache2::OK;
}
}
1;