You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Cristóvão Dalla Costa <cb...@bsi.com.br> on 2002/10/16 20:15:34 UTC

basic www auth

Hi

I'd like to do basic www authentication on my scripts. Apache::Auth::DBI 
isn't good since it would waste a database connection, and just add 
unnecessary complication. I'd like to do something like:

if (! check ($username, $password)) {
	send_unauthorized_http_headers ();
}

I guess I can send the 401 response using $r->header_out, but I still 
haven't found out how to get the authentication information: username 
and password.

Thanks in advance.



Re: basic www auth

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Cristóvão Dalla Costa wrote:
> Hi
> 
> I'd like to do basic www authentication on my scripts. Apache::Auth::DBI 
> isn't good since it would waste a database connection, and just add 
> unnecessary complication. I'd like to do something like:
> 
> if (! check ($username, $password)) {
>     send_unauthorized_http_headers ();
> }
> 
> I guess I can send the 401 response using $r->header_out, but I still 
> haven't found out how to get the authentication information: username 
> and password.

you can see all of chapter 13 in the cookbook, but a basic 
PerlAuthenHandler and example of using the mod_perl authentication API 
can be found here:

http://www.modperlcookbook.org/code/ch13/Cookbook/Authenticate.pm

HTH

--Geoff