>  <LocationMatch /(?i)protected/>
>    AuthType Basic
>    AuthName "Test Authentication"
>    AuthUserFile /www/xperience.ch/conf/.htpasswd
>    require valid-user
>  </LocationMatch>

next test - keep all that the same but substitute

  PerlAuthenHandler My::Authen

for

 AuthUserFile /www/xperience.ch/conf/.htpasswd

and use this handler:

  package My::Authen;

  use Apache2::RequestRec ();
  use Apache2::Access ();

  use Apache2::Const -compile => qw(OK AUTH_REQUIRED);

  use strict;

  sub handler {

    my $r = shift;

    my ($status, $password) = $r->get_basic_auth_pw;

    return $status unless $status == Apache2::Const::OK;

    if ($r->user eq 'foo' && $password eq 'bar') {
      return Apache2::Const::OK;
    }

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

  1;

just using Apache2::Const::OK in your httpd.conf bypasses some
httpd-core API calls that authen might be expecting.  this setup
exercises everything pretty much the way the default file authen handler
does.

--Geoff

Reply via email to