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 1521 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 130 93 if @_
767 9 123 if (overload::StrVal($runmode_test) =~ /^Regexp=/) { }
8 115 elsif (ref $runmode_test and ref $runmode_test eq 'CODE') { }
1 114 elsif ($runmode_test eq ':all') { }
769 1 8 if $runmode =~ /$runmode_test/
772 1 7 if &$runmode_test($runmode)
778 66 48 if $runmode eq $runmode_test
784 2 9 if $sub and $RUNMODES{$sub}
823 1 29 if ($config->{'POST_LOGIN_RUNMODE'}) { }
1 28 elsif ($config->{'POST_LOGIN_URL'}) { }
1 27 elsif (my $destination = $cgiapp->authen->_detaint_destination) { }
853 0 63 if ($config->{'LOGIN_RUNMODE'}) { }
0 63 elsif ($config->{'LOGIN_URL'}) { }
880 0 1 if ($config->{'LOGOUT_RUNMODE'}) { }
0 1 elsif ($config->{'LOGOUT_URL'}) { }
906 107 0 unless $config->{'LOGIN_RUNMODE'} or $config->{'LOGIN_URL'}
908 107 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 31 125 $self->username ? :
1089 82 8 unless ($self->{'drivers'})
1093 79 3 defined $config->{'DRIVER'} ? :
1098 2 104 if (index($drivername, 'Authen::Simple') == 0)
1130 115 419 unless ($self->{'store'})
1135 115 0 if $config->{'STORE'} and ref $config->{'STORE'} eq 'ARRAY'
1136 0 115 unless ($store_module)
1138 0 0 if ($self->_cgiapp->can('session') and UNIVERSAL::isa($self->_cgiapp->session, 'CGI::Session')) { }
1186 698 116 if $self->{'initialized'}
1192 0 116 if (UNIVERSAL::can($self->_cgiapp, 'devpopup'))
1205 71 45 if ($credentials[0])
1209 0 71 if $store->fetch('username')
1211 31 52 if (my $username = $driver->verify_credentials(@credentials))
1219 0 0 if ($login_config->{'REMEMBERUSER_OPTION'} and scalar $query->param('authen_rememberuser'))
1230 32 31 unless ($self->username)
1237 19 44 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 76 66 if $self->{'display'}
1333 2 1520 unless defined $cgiapp and UNIVERSAL::isa($cgiapp, 'CGI::Application')
1336 176 1344 unless defined $cgiapp->{'__CAP_AUTHENTICATION_INSTANCE'}
1369 1 106 if (scalar $self->query->param('authen_logout'))
1375 30 76 if ($authen->is_new_login)
1382 4 72 if ($config->{'LOGIN_SESSION_TIMEOUT'})
1396 65 11 if ($authen->is_protected_runmode($run_mode))
1398 63 1 unless ($authen->is_authenticated)
1424 0 63 if (my $sub = $authen->_config->{'RENDER_LOGIN'}) { }
1458 4 113 if ($destination and $destination =~ /$regexp/) { }
1472 87 2 if ($query->self_url =~ /$regexp/)
1483 0 89 if ($query->url(-'absolute', 1, -'path_info', 1) =~ /$regexp/)
1496 41 33 if ((scalar $query->param($username) || $query->cookie($cookiename) || '') =~ /$regexp/)
1512 220 60 if $class->require
1519 1760 22 ref $self ? :
1521 1760 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