On Wed 30 Sep 2009, Bernhard Janetzki wrote:
> Hello together,
> i'm trying basic authentication via
>
> ## apache2 config:
> <Location /auth>
> SetHandler perl-script
> PerlAuthenHandler DataExchange::AuthHandler
> #PerlResponseHandler ModPerl::Registry
> Options +ExecCGI
> PerlOptions +GlobalRequest
>
> AuthType Basic
> AuthName "The Gate"
> Require valid-user
> </Location>
>
>
> ## Example script:
>
> package DataExchange::AuthHandler;
>
> use strict;
> use warnings;
>
> use Apache2::Access ();
> use Apache2::RequestUtil ();
>
> use Apache2::Const -compile => qw(OK HTTP_UNAUTHORIZED);
>
> sub handler {
> my $r = shift;
>
> warn $r->user();
>
> my $password = $r->get_basic_auth_pw;
have a look at
http://perl.apache.org/docs/2.0/api/Apache2/Access.html#C_get_basic_auth_pw_
get_basic_auth_pw returns a status and the password. Your code has to
check that status before proceeding.
see also
http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlAuthenHandler
Torsten
--
Need professional mod_perl support?
Just hire me: [email protected]