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;

    my $user = $r->user;
    if ($r->user eq $password) {
        print Apache2::Const::OK;
    }

    $r->note_basic_auth_failure;
    return Apache2::Const::HTTP_UNAUTHORIZED;
}

1;

My password is filled up, but $r->user is undefined...
Any ideas?

Thanks!
Börni

p.s. mod_perl 2.0.4

Reply via email to