blib/lib/Lemonldap/NG/Portal/Auth/Slave.pm

filter: Statementstmt 94.4% 34 / 36 Branchbran 60.0% 6 / 10 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 6 totaltotal 72.8% 51 / 70 CC 8 SCAR 15.0
CC
8
Cov
81%
extractFormInfo
8.6
getDisplayType
2.1
BEGIN
1.0
CRAP 4.5
« blib/lib/Lemonldap/NG/Portal/Auth/Remote.pm ↑ Summary blib/lib/Lemonldap/NG/Portal/Password/DBI.pm »
1 package Lemonldap::NG::Portal::Auth::Slave;
2  
3 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # Add constants used by this module
7 5 ▶use Lemonldap::NG::Portal::Main::Constants qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
8 PE_OK
9 PE_FORBIDDENIP
10 PE_USERNOTFOUND
11 PE_MALFORMEDUSER
12 5 );
13  
14 5 our $VERSION = '2.23.0';
15  
16 5 extends qw(
17 Lemonldap::NG::Portal::Main::Auth
18 Lemonldap::NG::Portal::Lib::Slave
19 );
20  
21 # INITIALIZATION
22  
23 29 ▶sub init { 1 }
Subroutine init: called CC=1 SCAR=0.0
Pod undocumented
24  
25 # RUNNING METHODS
26  
27 3 ▶sub extractFormInfo {
Subroutine extractFormInfo: called CC=7 SCAR=21.5
Pod undocumented
28 3 my ( $self, $req ) = @_;
29 3 ▶ return PE_FORBIDDENIP
Branch: 1 branch
BranchTrueFalseTotal
unless $self->checkIP($req) and $self->checkHeader($req) and $self->checkCertificate($req) 0 3 3
Condition33%2/6
$self->checkIP($req) and $self->checkHeader($req) and $self->checkCertificate($req)
!ll&&!rl&&r
003
$self->checkIP($req) and $self->checkHeader($req)
!ll&&!rl&&r
003
MC/DC0%0/3
$self->checkIP($req) and $self->checkHeader($req) and $self->checkCertificate($req)
$self->checkIP($req) $self->checkHeader($req) $self->checkCertificate($req)
Truth table25%1/4
A and B and C
A= $self->checkIP($req)B= $self->checkHeader($req)C= $self->checkCertificate($req)
ABCresult
0XX0
10X0
1100
1111
30 unless ( $self->checkIP($req)
31 and $self->checkHeader($req)
32 and $self->checkCertificate($req) );
33  
34 3 ▶ unless ( $self->conf->{slaveUserHeader} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->conf->{"slaveUserHeader"}) 0 3 3
35 0 $self->logger->debug('slaveUserHeader is undefined');
36 0 return PE_USERNOTFOUND;
37 }
38  
39 3 my $user_header = $self->conf->{slaveUserHeader};
40 3 $user_header = 'HTTP_' . uc($user_header);
41 3 $user_header =~ s/\-/_/g;
42  
43 3 ▶ unless ( $req->env->{$user_header} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($req->env->{$user_header}) 1 2 3
44 $self->userLogger->error(
45 1 "No header " . $self->conf->{slaveUserHeader} . " found" );
46 1 return PE_USERNOTFOUND;
47 }
48  
49 return PE_MALFORMEDUSER
50 2 ▶ unless ( $req->env->{$user_header} =~ /$self->{conf}->{userControl}/ );
Branch: 1 branch
BranchTrueFalseTotal
unless $req->env->{$user_header} =~ /$self->{"conf"}{"userControl"}/ 0 2 2
51  
52 2 $req->{user} = $req->env->{$user_header};
53 2 return PE_OK;
54 }
55  
56 2 ▶sub authenticate {
Subroutine authenticate: called CC=1 SCAR=0.0
Pod undocumented
57 2 my ( $self, $req ) = @_;
58 2 return PE_OK;
59 }
60  
61 2 ▶sub setAuthSessionInfo {
Subroutine setAuthSessionInfo: called CC=1 SCAR=0.0
Pod undocumented
62 2 my ( $self, $req ) = @_;
63 2 $req->{sessionInfo}->{authenticationLevel} = $self->conf->{slaveAuthnLevel};
64 2 return PE_OK;
65 }
66  
67 2 ▶sub getDisplayType {
Subroutine getDisplayType: called CC=2 SCAR=7.2
Pod undocumented
68 2 my ($self) = @_;
69 2 ▶ return ( $self->{conf}->{slaveDisplayLogo} ? "logo" : "_none_" );
Branch: 1 branch
BranchTrueFalseTotal
$self->{'conf'}{'slaveDisplayLogo'} ? : 2 0 2
70 }
71  
72 1 ▶sub authLogout {
Subroutine authLogout: called CC=1 SCAR=0.0
Pod undocumented
73 1 my ( $self, $req ) = @_;
74 1 return PE_OK;
75 }
76  
77 5 1;
« blib/lib/Lemonldap/NG/Portal/Auth/Remote.pm ↑ Summary blib/lib/Lemonldap/NG/Portal/Password/DBI.pm »