| 1 | package Sledge::Authorizer::BasicAuth; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use base qw(Sledge::Authorizer Class::Data::Inheritable); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use 5.008001; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | our $VERSION = '0.07'; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use MIME::Base64 qw//; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 1 | __PACKAGE__->mk_classdata('error_template'); | |||||||||||||||||||||||||||
| 12 | 1 | __PACKAGE__->mk_classdata(realm => 'Authorization Required'); | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 0 | ▶ | sub basic_auth { | ||||||||||||||||||||||||||
|
Subroutine
basic_auth: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 15 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 16 | 0 | my $page = shift; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 0 | ▶ | my $auth_header = $page->r->header_in('Authorization') || ''; | ||||||||||||||||||||||||||
|
Condition0%0/2
$page->r->header_in('Authorization') || ''
MC/DC0%0/1
$page->r->header_in('Authorization') || ''
$page->r->header_in('Authorization')
Truth table0%0/2
A
A= $page->r->header_in('Authorization')
| |||||||||||||||||||||||||||||
| 19 | 0 | ▶ | if ($auth_header =~ /^Basic (.+)$/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | 0 | my ($user, $pass) = split q{:}, MIME::Base64::decode_base64($1); | |||||||||||||||||||||||||||
| 21 | 0 | ▶ | if (defined $user and defined $pass) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $user and defined $pass
MC/DC0%0/2
defined $user and defined $pass
defined $user
defined $pass
Truth table0%0/3
A and B
A= defined $userB= defined $pass
| |||||||||||||||||||||||||||||
| 22 | 0 | return ($user, $pass); | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | 0 | return $self->show_error_page($page); | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | ▶ | sub show_error_page { | ||||||||||||||||||||||||||
|
Subroutine
show_error_page: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 29 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 30 | 0 | my $page = shift; | |||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | $page->load_template($self->error_template); | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | my $realm = $self->realm; | |||||||||||||||||||||||||||
| 35 | 0 | $page->r->header_out('WWW-Authenticate' => qq{Basic realm="$realm"}); | |||||||||||||||||||||||||||
| 36 | 0 | $page->r->status(401); | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | $page->output_content; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 1 | 1; | |||||||||||||||||||||||||||
| 42 | __END__ | ||||||||||||||||||||||||||||