File: TestUser.pm

package info (click to toggle)
libapache-authenhook-perl 2.00-04%2Bpristine-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 236 kB
  • sloc: perl: 182; makefile: 13; sh: 11
file content (41 lines) | stat: -rw-r--r-- 746 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package My::TestUser;

use Apache2::RequestRec;
use Apache2::RequestUtil;
use Apache2::Access;

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

use strict;

sub handler {

  my $r = shift;

  warn "trying ", $r->uri;
  warn "auth type ", $r->ap_auth_type;
  warn "auth type 2", $r->auth_type;
  if ($r->ap_auth_type eq 'Digest') {

   my ($user, $realm, $hash) = @_;

   warn "inside";
   if ($user eq 'testuser' && $realm eq 'realm1') {
     $$hash = '0a2e8a13afd0ea7b7e78cc22725bf06a';
     warn "ok";
     return Apache2::Const::OK;
   }
  }
  else {

   my ($user, $password) = @_;

   if ($user eq 'testuser' && $password eq 'testpass') {
     return Apache2::Const::OK;
   }
  }

  return Apache2::Const::HTTP_UNAUTHORIZED;
}

1;