blib/lib/Lemonldap/NG/Portal/Main/SecondFactor.pm

filter: Statementstmt 100% 32 / 32 Branchbran 75.0% 3 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 2 totaltotal 88.4% 46 / 52 CC 4 SCAR 5.2
CC
4
Cov
95%
init
3.0
__ANON__
2.0
BEGIN
1.0
CRAP 1.7
« blib/lib/Lemonldap/NG/Portal/Lib/_tokenRule.pm ↑ Summary blib/lib/Lemonldap/NG/Portal/Auth/Null.pm »
1 package Lemonldap::NG::Portal::Main::SecondFactor;
2  
3 52 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 52 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 52 ▶use Lemonldap::NG::Portal::Main::Constants qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
6 PE_OK
7 PE_ERROR
8 PE_NOTOKEN
9 PE_SENDRESPONSE
10 PE_TOKENEXPIRED
11 PE_BADCREDENTIALS
12 52 );
13  
14 52 our $VERSION = '2.20.0';
15  
16 52 extends qw(
17 Lemonldap::NG::Portal::Main::Plugin
18 Lemonldap::NG::Portal::Auth::_WebForm
19 );
20  
21 # INITIALIZATION
22  
23 has ott => (
24 is => 'rw',
25 lazy => 1,
26 37 ▶ default => sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
27 my $ott =
28 37 $_[0]->{p}->loadModule('Lemonldap::NG::Portal::Lib::OneTimeToken');
29 $ott->timeout( $_[0]->{conf}->{sfLoginTimeout}
30 37 ▶ || $_[0]->{conf}->{formTimeout} );
Condition66%2/3
$_[0]{'conf'}{'sfLoginTimeout'} || $_[0]{'conf'}{'formTimeout'}
l!l&&r!l&&!r
2350
MC/DC0%0/2
$_[0]{'conf'}{'sfLoginTimeout'} || $_[0]{'conf'}{'formTimeout'}
$_[0]{'conf'}{'sfLoginTimeout'} $_[0]{'conf'}{'formTimeout'}
Truth table66%2/3
A || B
A= $_[0]{'conf'}{'sfLoginTimeout'}B= $_[0]{'conf'}{'formTimeout'}
ABresult
1X1
011
000
31 37 return $ott;
32 }
33 52 );
34  
35 52 has prefix => ( is => 'rw' );
36 52 has logo => ( is => 'rw', default => '2f.png' );
37 52 has label => ( is => 'rw' );
38 52 has noRoute => ( is => 'ro' );
39 has authnLevel => (
40 is => 'rw',
41 lazy => 1,
42 1 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
43 1 return $_[0]->conf->{ $_[0]->prefix . '2fAuthnLevel' };
44 }
45 52 );
46  
47 has rule => (
48 is => 'rw',
49 lazy => 1,
50 64 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
51 64 return $_[0]->conf->{ $_[0]->prefix . '2fActivation' };
52 }
53 52 );
54  
55 # 'type' field of stored _2fDevices
56 # Defaults to the last component of the package name
57 # But can be overriden by sfExtra
58 has type => (
59 is => 'rw',
60 70 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
61 70 ( split( '::', ref( $_[0] ) ) )[-1];
62 }
63 52 );
64  
65 70 ▶sub init {
Subroutine init: called CC=3 SCAR=11.0
Pod undocumented
66 70 my ($self) = @_;
67  
68 # Set logo if overridden
69 $self->logo( $self->conf->{ $self->prefix . '2fLogo' } )
70 70 ▶ if $self->conf->{ $self->prefix . '2fLogo' };
Branch: 1 branch
BranchTrueFalseTotal
if $self->conf->{$self->prefix . '2fLogo'} 2 68 70
71  
72 # Set label if provided, translation files will be used otherwise
73 $self->label( $self->conf->{ $self->prefix . '2fLabel' } )
74 70 ▶ if $self->conf->{ $self->prefix . '2fLabel' };
Branch: 1 branch
BranchTrueFalseTotal
if $self->conf->{$self->prefix . '2fLabel'} 0 70 70
75  
76 70 return 1;
77 }
78  
79 2 ▶sub get2fTplParams {
Subroutine get2fTplParams: called CC=1 SCAR=0.0
Pod undocumented
80 2 my ( $self, $req ) = @_;
81  
82 2 return $self->p->_sfEngine->get2fTplParams( $req, $self );
83 }
84 52 1;
85 __END__
« blib/lib/Lemonldap/NG/Portal/Lib/_tokenRule.pm ↑ Summary blib/lib/Lemonldap/NG/Portal/Auth/Null.pm »