Apache-AuthLDAP
view release on metacpan or search on metacpan
AuthLDAP.pm view on Meta::CPAN
my $name = $r->connection->user;
my $basedn = $r->dir_config('BaseDN') || "";
my $ldapserver = $r->dir_config('LDAPServer') || "localhost";
my $ldapport = $r->dir_config('LDAPPort') || 389;
my $uidattr = $r->dir_config('UIDAttr') || "uid";
if ($sent_pwd eq "")
{
$r->note_basic_auth_failure;
$r->log_reason("user $name: no password supplied",$r->uri);
return AUTH_REQUIRED;
}
my $ld = new Net::LDAPapi($ldapserver,$ldapport);
if ($ld <= 0)
{
$r->note_basic_auth_failure;
$r->log_reason("user $name: LDAP Connection Failed",$r->uri);
return AUTH_REQUIRED;
}
AuthLDAP.pm view on Meta::CPAN
$status = $ld->bind_s($dn,$sent_pwd);
if ($status == LDAP_SUCCESS)
{
$r->push_handlers(PerlAuthzHandler => \&authz);
$ld->unbind;
return OK;
}
$ld->unbind;
$r->note_basic_auth_failure;
$r->log_reason("user $name: password mismatch", $r->uri);
return AUTH_REQUIRED;
}
sub authz
{
my $r = shift;
my $requires = $r->requires;
return OK unless $requires;
my $name = $r->connection->user;
( run in 0.512 second using v1.01-cache-2.11-cpan-49f99fa48dc )