Branch Coverage

blib/lib/CGI/Application/Plugin/Authentication.pm
Criterion Covered Total %
branch 206 228 90.3


line true false branch
22 2 31 if (not UNIVERSAL::isa($callpkg, 'CGI::Application')) { }
174 1566 23 if (ref $cgiapp) { }
547 96 22 ref $self ? :
550 1 117 if ref $self and defined $self->{'initialized'}
553 116 1 if (@_)
555 46 70 if (ref $_[0] eq 'HASH') { }
563 72 44 if (defined $props->{'DRIVER'})
565 1 71 if ref $props->{'DRIVER'} and &Scalar::Util::reftype($props->{'DRIVER'}) ne 'ARRAY'
571 2 69 if &Scalar::Util::reftype($config->{'DRIVER'}) ne 'ARRAY'
572 68 3 if &Scalar::Util::reftype($config->{'DRIVER'}[0]) ne 'ARRAY'
576 74 41 if (defined $props->{'STORE'})
578 1 73 if ref $props->{'STORE'} and &Scalar::Util::reftype($props->{'STORE'}) ne 'ARRAY'
583 15 58 if &Scalar::Util::reftype($config->{'STORE'}) ne 'ARRAY'
587 6 108 if (defined $props->{'POST_LOGIN_RUNMODE'})
589 1 5 if ref $props->{'POST_LOGIN_RUNMODE'}
594 9 104 if (defined $props->{'POST_LOGIN_URL'})
596 2 7 if $config->{'POST_LOGIN_RUNMODE'}
598 1 8 if ref $props->{'POST_LOGIN_URL'}
603 4 108 if (defined $props->{'LOGIN_RUNMODE'})
605 1 3 if ref $props->{'LOGIN_RUNMODE'}
610 7 104 if (defined $props->{'LOGIN_URL'})
612 1 6 if $config->{'LOGIN_RUNMODE'}
614 1 6 if ref $props->{'LOGIN_URL'}
619 4 106 if (defined $props->{'LOGOUT_RUNMODE'})
621 1 3 if ref $props->{'LOGOUT_RUNMODE'}
626 7 102 if (defined $props->{'LOGOUT_URL'})
628 1 6 if $config->{'LOGOUT_RUNMODE'}
630 1 6 if ref $props->{'LOGOUT_URL'}
635 17 91 if (defined $props->{'CREDENTIALS'})
637 1 16 if ref $props->{'CREDENTIALS'} and &Scalar::Util::reftype($props->{'CREDENTIALS'}) ne 'ARRAY'
641 1 15 if &Scalar::Util::reftype($config->{'CREDENTIALS'}) ne 'ARRAY'
645 20 87 if (defined $props->{'LOGIN_SESSION_TIMEOUT'})
647 1 19 if ref $props->{'LOGIN_SESSION_TIMEOUT'} and ref $props->{'LOGIN_SESSION_TIMEOUT'} ne 'HASH'
649 7 12 if (not ref $props->{'LOGIN_SESSION_TIMEOUT'}) { }
651 1 6 unless defined $options->{'IDLE_FOR'}
653 5 7 if ($props->{'LOGIN_SESSION_TIMEOUT'}{'IDLE_FOR'})
655 1 4 unless defined $options->{'IDLE_FOR'}
657 5 6 if ($props->{'LOGIN_SESSION_TIMEOUT'}{'EVERY'})
659 1 4 unless defined $options->{'EVERY'}
661 5 5 if ($props->{'LOGIN_SESSION_TIMEOUT'}{'CUSTOM'})
663 1 4 unless ref $options->{'CUSTOM'} eq 'CODE'
665 1 8 if %{$props->{'LOGIN_SESSION_TIMEOUT'};}
673 33 68 if (defined $props->{'POST_LOGIN_CALLBACK'})
675 2 31 unless ref $props->{'POST_LOGIN_CALLBACK'} eq 'CODE'
680 3 96 if (defined $props->{'RENDER_LOGIN'})
682 2 1 unless ref $props->{'RENDER_LOGIN'} eq 'CODE'
687 26 71 if (defined $props->{'LOGIN_FORM'})
689 1 25 unless ref $props->{'LOGIN_FORM'} eq 'HASH'
694 3 93 if (defined $props->{'DETAINT_URL_REGEXP'}) { }
702 2 94 if (defined $props->{'DETAINT_USERNAME_REGEXP'}) { }
710 1 95 if %$props
749 133 95 if @_
767 9 125 if (overload::StrVal($runmode_test) =~ /^Regexp=/) { }
8 117 elsif (ref $runmode_test and ref $runmode_test eq 'CODE') { }
1 116 elsif ($runmode_test eq ':all') { }
769 1 8 if $runmode =~ /$runmode_test/
772 1 7 if &$runmode_test($runmode)
778 68 48 if $runmode eq $runmode_test
784 2 9 if $sub and $RUNMODES{$sub}
823 1 30 if ($config->{'POST_LOGIN_RUNMODE'}) { }
1 29 elsif ($config->{'POST_LOGIN_URL'}) { }
1 28 elsif (my $destination = $cgiapp->authen->_detaint_destination) { }
853 0 66 if ($config->{'LOGIN_RUNMODE'}) { }
0 66 elsif ($config->{'LOGIN_URL'}) { }
880 0 1 if ($config->{'LOGOUT_RUNMODE'}) { }
0 1 elsif ($config->{'LOGOUT_URL'}) { }
906 110 0 unless $config->{'LOGIN_RUNMODE'} or $config->{'LOGIN_URL'}
908 110 0 unless $config->{'LOGOUT_RUNMODE'} or $config->{'LOGOUT_URL'}
928 2 3 unless $self->username
930 0 3 if $new
949 5 4 unless $self->username
951 1 3 if $new
969 1 4 $self->{'is_login_timeout'} ? :
986 32 130 $self->username ? :
1089 85 8 unless ($self->{'drivers'})
1093 82 3 defined $config->{'DRIVER'} ? :
1098 2 107 if (index($drivername, 'Authen::Simple') == 0)
1130 118 431 unless ($self->{'store'})
1135 118 0 if $config->{'STORE'} and ref $config->{'STORE'} eq 'ARRAY'
1136 0 118 unless ($store_module)
1138 0 0 if ($self->_cgiapp->can('session') and UNIVERSAL::isa($self->_cgiapp->session, 'CGI::Session')) { }
1186 718 119 if $self->{'initialized'}
1192 0 119 if (UNIVERSAL::can($self->_cgiapp, 'devpopup'))
1205 74 45 if ($credentials[0])
1209 0 74 if $store->fetch('username')
1211 32 54 if (my $username = $driver->verify_credentials(@credentials))
1219 0 0 if ($login_config->{'REMEMBERUSER_OPTION'} and scalar $query->param('authen_rememberuser'))
1230 34 32 unless ($self->username)
1237 19 47 if $config->{'POST_LOGIN_CALLBACK'}
1244 4 5 if ($config->{'LOGIN_SESSION_TIMEOUT'} and not $self->{'is_new_login'} and $self->username)
1246 1 3 if ($config->{'LOGIN_SESSION_TIMEOUT'}{'IDLE_FOR'} and time - $self->last_access >= $config->{'LOGIN_SESSION_TIMEOUT'}{'IDLE_FOR'}) { }
1 2 elsif ($config->{'LOGIN_SESSION_TIMEOUT'}{'EVERY'} and time - $self->last_login >= $config->{'LOGIN_SESSION_TIMEOUT'}{'EVERY'}) { }
1 1 elsif ($config->{'LOGIN_SESSION_TIMEOUT'}{'CUSTOM'} and $config->{'LOGIN_SESSION_TIMEOUT'}{'CUSTOM'}->($self)) { }
1274 79 69 if $self->{'display'}
1333 2 1565 unless defined $cgiapp and UNIVERSAL::isa($cgiapp, 'CGI::Application')
1336 179 1386 unless defined $cgiapp->{'__CAP_AUTHENTICATION_INSTANCE'}
1369 1 109 if (scalar $self->query->param('authen_logout'))
1375 31 78 if ($authen->is_new_login)
1382 4 74 if ($config->{'LOGIN_SESSION_TIMEOUT'})
1396 67 11 if ($authen->is_protected_runmode($run_mode))
1398 66 1 unless ($authen->is_authenticated)
1424 0 66 if (my $sub = $authen->_config->{'RENDER_LOGIN'}) { }
1458 4 117 if ($destination and $destination =~ /$regexp/) { }
1472 90 2 if ($query->self_url =~ /$regexp/)
1483 0 92 if ($query->url('-absolute', 1, '-path_info', 1) =~ /$regexp/)
1496 43 34 if ((scalar $query->param($username) || $query->cookie($cookiename) || '') =~ /$regexp/)
1512 226 60 if $class->require
1519 1817 22 ref $self ? :
1521 1817 22 if (ref $self) { }
1534 0 0 if ($self->username)
1546 0 0 $r ? :
1572 0 32 unless defined $time
1594 29 3 if ($time =~ /^([+-]?(?:\d+|\d*\.\d*))([smhdwMy]?)$/)
1595 1 28 if !$2 || $2 eq 's' and $1 != int $1