blib/lib/Lemonldap/NG/Portal/Plugins/ForceAuthn.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 34 CC 3 SCAR 18.4
CC
3
Cov
0%
run
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 6.3
1 package Lemonldap::NG::Portal::Plugins::ForceAuthn;
2  
3 use strict;
4 use Mouse;
5 use Lemonldap::NG::Portal::Main::Constants qw(
6 PE_OK
7 PE_MUSTAUTHN
8 );
9  
10 our $VERSION = '2.22.0';
11  
12 extends 'Lemonldap::NG::Portal::Main::Plugin';
13  
14 # INITIALIZATION
15  
16 use constant forAuthUser => 'run';
17  
18 # RUNNING METHOD
19  
20 sub run {
21 my ( $self, $req ) = @_;
22 if ( $req->env->{HTTP_HOST}
23 and $req->portal =~ /\Q$req->{env}->{HTTP_HOST}/ )
24 {
25 my $delta = time - $req->{sessionInfo}->{_lastAuthnUTime};
26 $self->logger->debug( "Delta with last Authn -> " . $delta );
27  
28 return $delta <= $self->conf->{portalForceAuthnInterval}
29 ? PE_OK
30 : PE_MUSTAUTHN;
31 }
32 }
33  
34 1;