Apache-AuthenNISPlus
view release on metacpan or search on metacpan
AuthenNISPlus.pm view on Meta::CPAN
# ok if user is one of these users
elsif ($require eq 'user') {return OK if grep $name eq $_, @rest}
# ok if user is member of a required group.
elsif ($require eq 'group') {
my $group_table = Net::NISPlus::Table->new($group_table);
unless ($group_table){
$r->note_basic_auth_failure;
$r->log_reason($self . ': cannot get nis+ group table', $r->uri);
return AUTH_REQUIRED;
}
my %groups_to_gids;
foreach ($group_table->list()){$groups_to_gids{@{$_}[0]} = @{$_}[2]}
for my $group (@rest) {
next unless exists $groups_to_gids{$group};
return OK if $r->notes($name . 'Group') == $groups_to_gids{$group};
}
}
}
$r->note_basic_auth_failure;
$r->log_reason(
$self . ': user ' . $name . ' not member of required group in ' .
$group_table, $r->uri
);
return AUTH_REQUIRED;
}
1;
__END__
=pod
=head1 NAME
Apache::AuthenNISPlus - Authenticate into a NIS+ domain
=head1 SYNOPSIS
#httpd.conf
<Location>
AuthName "your nis+ account"
AuthType Basic
PerlSetVar NISPlus_Passwd_Table passwd.org_dir.yoyodyne.com
PerlSetVar NISPlus_Group_Table group.org_dir.yoyodyne.com
PerlAuthenHandler Apache::AuthenNISPlus
require group eng
require user john larry
</Location>
=head1 DESCRIPTION
Authenticate into a nis+ domain.
Requires the Net::NISPlus module.
=head1 AUTHOR
valerie at savina dot com (Valerie Delane), originally based more or
less on code shamelessly lifted from Doug MacEachern's
Apache::AuthNIS.
=head1 COPYRIGHT
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 SEE ALSO
mod_perl(3), Apache(3).
=cut
( run in 0.768 second using v1.01-cache-2.11-cpan-acf6aa7dc9e )