Apache-AuthenNIS

 view release on metacpan or  search on metacpan

AuthenNIS.pm  view on Meta::CPAN

    if(crypt($sent_pwd, $hash) eq $hash) {
        return MP2 ? Apache::OK : Apache::Constants::OK;
    } else {
        if (lc($allowaltauth) eq "yes")
        {
           return MP2 ? Apache::DECLINED : Apache::Constants::DECLINED;
        }
        else
        {
	         $r->note_basic_auth_failure;
	         MP2 ? $r->log_error("Apache::AuthenNIS - user $name: bad password", $r->uri) : $r->log_reason("Apache::AuthenNIS - user $name: bad password", $r->uri);
	         return MP2 ? Apache::HTTP_UNAUTHORIZED : Apache::Constants::HTTP_UNAUTHORIZED;
	      }
    }

    return MP2 ? Apache::OK : Apache::Constants::OK;
}

1;

__END__

AuthenNIS.pm  view on Meta::CPAN


= head1 DESCRIPTION

This perl module is designed to work with mod_perl and the Net::NIS
module by Rik Haris (B<rik.harris@fulcrum.com.au>).  It is a direct
adaptation (i.e. I modified the code) of Michael Parker's
(B<parker@austx.tandem.com>) Apache::AuthenSmb module.

The module uses Net::NIS::yp_match to retrieve the "passwd" entry from the
passwd.byname map, using the supplied username as the search key.  It then
uses crypt() to verify that the supplied password matches the retrieved
hashed password.

= head2 Apache::AuthenNIS vs. Apache::AuthzNIS

I've taken "authentication" to be meaningful only in terms of a user and
password combination, not group membership.  This means that you can use
Apache::AuthenNIS with the B<require user> and B<require valid-user>
directives.  In the NIS context I consider B<require group> to be an
"authorization" concern.  I.e., Group authorization consists of
establishing whether the already authenticated user is a member of one of
the indicated groups in the B<require group> directive.  This process may
be handled by B<Apache::AuthzNIS>.

I welcome any feedback on this module, esp. code improvements, given
that it was written hastily, to say the least.

README  view on Meta::CPAN

DESCRIPTION
     This perl module is designed to work with mod_perl and the
     Net::NIS module by Rik Haris (rik.harris@fulcrum.com.au).
     It is a direct adaptation (i.e. I modified the code) of
     Michael Parker's (parker@austx.tandem.com) Apache::AuthenSmb
     module.

     The module uses Net::NIS::yp_match to retrieve the "passwd"
     entry from the passwd.byname map, using the supplied
     username as the search key.  It then uses crypt() to verify
     that the supplied password matches the retrieved hashed
     password.

     Apache::AuthenNIS vs. Apache::AuthzNIS

     I've taken "authentication" to be meaningful only in terms
     of a user and password combination, not group membership.
     This means that you can use Apache::AuthenNIS with the
     require user and require valid-user directives.  In the NIS
     context I consider require group to be an "authorization"
     concern.  I.e., Group authorization consists of establishing
     whether the already authenticated user is a member of one of
     the indicated groups in the require group directive.  This
     process can be handled by Apache::AuthzNIS.

     I welcome any feedback on this module, esp. code
     improvements, given that it was written hastily, to say the



( run in 0.927 second using v1.01-cache-2.11-cpan-49f99fa48dc )