examples/auth/AuthTest.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 48 CC 2 SCAR 11.0
CC
2
Cov
0%
Authenticator
6.0
Configure
2.0
Initialize
2.0
CRAP 3.0
1 # Apache::AppSamurai::AuthTest - Sample AppSamurai authentication plugin.
2  
3 ##### DO NOT USE THIS! THIS IS A SAMPLE! #################################
4 #### Feel free to base your custom authenticaiton module on it, though ####
5  
6 # $Id: AuthTest.pm,v 1.4 2007/09/13 07:00:16 pauldoom Exp $
7  
8 package Apache::AppSamurai::AuthTest;
9 use strict;
10  
11 use vars qw($VERSION @ISA);
12 $VERSION = substr(q$Revision: 1.4 $, 10, -1);
13  
14 use Carp;
15 use Apache::AppSamurai::AuthBase;
16  
17 @ISA = qw( Apache::AppSamurai::AuthBase );
18  
19 sub Configure {
20 my $self = shift;
21
22 # Pull defaults from AuthBase and save.
23 $self->SUPER::Configure();
24 my $conft = $self->{conf};
25  
26 # Initial configuration. Put defaults here before the @_ args are
27 # pulled in.
28 $self->{conf} = { %{$conft},
29 TestThing => "MegaGarbage",
30 @_,
31 };
32 return 1;
33 }
34  
35 sub Initialize {
36 my $self = shift;
37  
38 # Well, this is a dumb test module, so there isn't anything to do.
39  
40 return 1;
41 }
42  
43  
44 # Make a backdoor. Yes, in case you didn't read above, let me reiterate:
45 # DO NOT USE THIS MODULE IN PRODUCTION!!!!
46 sub Authenticator {
47 my $self = shift;
48 my $user = shift;
49 my $pass = shift;
50  
51 if (($user eq 'satan') && ($pass eq '6666')) {
52 return 1; # Ok!
53 }
54  
55 # DEFAULT DENY #
56 return 0;
57 }
58
59 1;
60  
61 __END__