Branch Coverage

blib/lib/CGI/Application/Plugin/Authentication.pm
Criterion Covered Total %
branch 207 228 90.7


line true false branch
22 2 31 if (not UNIVERSAL::isa($callpkg, 'CGI::Application')) { }
178 2091 30 if (ref $cgiapp) { }
551 102 29 ref $self ? :
553 1 130 if ref $self and defined $$self{'initialized'}
557 129 1 if (@_)
559 46 83 if (ref $_[0] eq 'HASH') { }
567 85 44 if (defined $$props{'DRIVER'})
568 1 84 if ref $$props{'DRIVER'} and &Scalar::Util::reftype($$props{'DRIVER'}) ne 'ARRAY'
575 2 82 if &Scalar::Util::reftype($$config{'DRIVER'}) ne 'ARRAY'
576 77 7 if &Scalar::Util::reftype($$config{'DRIVER'}[0]) ne 'ARRAY'
580 87 41 if (defined $$props{'STORE'})
581 1 86 if ref $$props{'STORE'} and &Scalar::Util::reftype($$props{'STORE'}) ne 'ARRAY'
587 28 58 if &Scalar::Util::reftype($$config{'STORE'}) ne 'ARRAY'
591 6 121 if (defined $$props{'POST_LOGIN_RUNMODE'})
592 1 5 if ref $$props{'POST_LOGIN_RUNMODE'}
598 10 116 if (defined $$props{'POST_LOGIN_URL'})
599 3 7 if $$config{'POST_LOGIN_RUNMODE'}
601 1 9 if ref $$props{'POST_LOGIN_URL'}
607 4 121 if (defined $$props{'LOGIN_RUNMODE'})
608 1 3 if ref $$props{'LOGIN_RUNMODE'}
614 7 117 if (defined $$props{'LOGIN_URL'})
615 1 6 if $$config{'LOGIN_RUNMODE'}
617 1 6 if ref $$props{'LOGIN_URL'}
623 4 119 if (defined $$props{'LOGOUT_RUNMODE'})
624 1 3 if ref $$props{'LOGOUT_RUNMODE'}
630 7 115 if (defined $$props{'LOGOUT_URL'})
631 1 6 if $$config{'LOGOUT_RUNMODE'}
633 1 6 if ref $$props{'LOGOUT_URL'}
639 22 99 if (defined $$props{'CREDENTIALS'})
640 1 21 if ref $$props{'CREDENTIALS'} and &Scalar::Util::reftype($$props{'CREDENTIALS'}) ne 'ARRAY'
645 1 20 if &Scalar::Util::reftype($$config{'CREDENTIALS'}) ne 'ARRAY'
649 20 100 if (defined $$props{'LOGIN_SESSION_TIMEOUT'})
650 1 19 if ref $$props{'LOGIN_SESSION_TIMEOUT'} and ref $$props{'LOGIN_SESSION_TIMEOUT'} ne 'HASH'
653 7 12 if (not ref $$props{'LOGIN_SESSION_TIMEOUT'}) { }
655 1 6 unless defined $$options{'IDLE_FOR'}
657 5 7 if ($$props{'LOGIN_SESSION_TIMEOUT'}{'IDLE_FOR'})
659 1 4 unless defined $$options{'IDLE_FOR'}
661 5 6 if ($$props{'LOGIN_SESSION_TIMEOUT'}{'EVERY'})
663 1 4 unless defined $$options{'EVERY'}
665 5 5 if ($$props{'LOGIN_SESSION_TIMEOUT'}{'CUSTOM'})
667 1 4 unless ref $$options{'CUSTOM'} eq 'CODE'
669 1 8 if %{$$props{'LOGIN_SESSION_TIMEOUT'};}
677 33 81 if (defined $$props{'POST_LOGIN_CALLBACK'})
678 2 31 unless ref $$props{'POST_LOGIN_CALLBACK'} eq 'CODE'
684 3 109 if (defined $$props{'RENDER_LOGIN'})
685 2 1 unless ref $$props{'RENDER_LOGIN'} eq 'CODE'
691 26 84 if (defined $$props{'LOGIN_FORM'})
692 1 25 unless ref $$props{'LOGIN_FORM'} eq 'HASH'
698 3 106 if (defined $$props{'DETAINT_URL_REGEXP'}) { }
706 2 107 if (defined $$props{'DETAINT_USERNAME_REGEXP'}) { }
714 1 108 if %$props
753 179 124 if @_
771 9 154 if (overload::StrVal($runmode_test) =~ /^Regexp=/) { }
8 146 elsif (ref $runmode_test and ref $runmode_test eq 'CODE') { }
1 145 elsif ($runmode_test eq ':all') { }
773 1 8 if $runmode =~ /$runmode_test/
776 1 7 if &$runmode_test($runmode)
782 97 48 if $runmode eq $runmode_test
788 2 17 if $sub and $RUNMODES{$sub}
827 1 42 if ($$config{'POST_LOGIN_RUNMODE'}) { }
1 41 elsif ($$config{'POST_LOGIN_URL'}) { }
1 40 elsif (my $destination = $cgiapp->authen->_detaint_destination) { }
857 0 94 if ($$config{'LOGIN_RUNMODE'}) { }
0 94 elsif ($$config{'LOGIN_URL'}) { }
884 0 1 if ($$config{'LOGOUT_RUNMODE'}) { }
0 1 elsif ($$config{'LOGOUT_URL'}) { }
909 151 0 unless $$config{'LOGIN_RUNMODE'} or $$config{'LOGIN_URL'}
911 151 0 unless $$config{'LOGOUT_RUNMODE'} or $$config{'LOGOUT_URL'}
932 2 3 unless $self->username
934 0 3 if $new
953 5 4 unless $self->username
955 1 3 if $new
973 1 4 $$self{'is_login_timeout'} ? :
990 44 187 $self->username ? :
1093 140 9 unless ($$self{'drivers'})
1097 137 3 defined $$config{'DRIVER'} ? :
1102 2 194 if (index($drivername, 'Authen::Simple') == 0)
1134 164 647 unless ($$self{'store'})
1139 164 0 if $$config{'STORE'} and ref $$config{'STORE'} eq 'ARRAY'
1140 0 164 unless ($store_module)
1142 0 0 if ($self->_cgiapp->can('session') and UNIVERSAL::isa($self->_cgiapp->session, 'CGI::Session')) { }
1190 1034 165 if $$self{'initialized'}
1196 0 165 if (UNIVERSAL::can($self->_cgiapp, 'devpopup'))
1209 130 35 if ($credentials[0])
1213 0 130 if $store->fetch('username')
1215 44 121 if (my $username = $driver->verify_credentials(@credentials))
1223 0 44 if ($$login_config{'REMEMBERUSER_OPTION'} and $query->param('authen_rememberuser'))
1234 73 44 unless ($self->username)
1240 19 98 if $$config{'POST_LOGIN_CALLBACK'}
1248 4 5 if ($$config{'LOGIN_SESSION_TIMEOUT'} and not $$self{'is_new_login'} and $self->username)
1250 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)) { }
1278 107 97 if $$self{'display'}
1337 2 2090 unless defined $cgiapp and UNIVERSAL::isa($cgiapp, 'CGI::Application')
1340 225 1865 unless defined $$cgiapp{'__CAP_AUTHENTICATION_INSTANCE'}
1373 1 150 if ($self->query->param('authen_logout'))
1379 43 107 if ($authen->is_new_login)
1386 4 103 if ($$config{'LOGIN_SESSION_TIMEOUT'})
1400 96 11 if ($authen->is_protected_runmode($run_mode))
1402 94 1 unless ($authen->is_authenticated)
1428 0 94 if (my $sub = $authen->_config->{'RENDER_LOGIN'}) { }
1462 4 157 if ($destination and $destination =~ /$regexp/) { }
1476 115 2 if ($query->self_url =~ /$regexp/)
1487 0 120 if ($query->url(-'absolute', 1, -'path_info', 1) =~ /$regexp/)
1500 60 45 if (($query->param($username) || $query->cookie($cookiename) || '') =~ /$regexp/)
1516 359 109 if $class->require
1523 2472 29 ref $self ? :
1525 2472 29 if (ref $self) { }
1538 0 0 if ($self->username)
1550 0 0 $r ? :
1576 0 32 unless defined $time
1598 29 3 if ($time =~ /^([+-]?(?:\d+|\d*\.\d*))([smhdwMy]?)$/)
1599 1 28 if !$2 || $2 eq 's' and $1 != int $1