| 1 | package Catalyst::Plugin::Session::State::Header; | ||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | extends 'Catalyst::Plugin::Session::State'; | |||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use MRO::Compat; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Catalyst::Utils (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 2 | our $VERSION = '0.02'; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 0 | ▶ | sub extend_session_id { | ||||||||||||||||||||||||||
|
Subroutine
extend_session_id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 12 | 0 | my ( $c, $sid, $expires ) = @_; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 0 | $c->maybe::next::method( $sid, $expires ); | |||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 0 | ▶ | sub set_session_id { | ||||||||||||||||||||||||||
|
Subroutine
set_session_id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 18 | 0 | my ( $c, $sid ) = @_; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 0 | return $c->maybe::next::method($sid); | |||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | sub get_session_id { | ||||||||||||||||||||||||||
|
Subroutine
get_session_id: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 24 | 0 | my $c = shift; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | my $path = uni_path($c->request->path()); | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | my $cfg = $c->_session_plugin_config(); | |||||||||||||||||||||||||||
| 29 | 0 | ▶ | if ($cfg->{allowed_uri} && $path !~ m/$cfg->{allowed_uri}/s) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$cfg->{"allowed_uri"} and not $path =~ /$cfg->{"allowed_uri"}/s
MC/DC0%0/2
$cfg->{"allowed_uri"} and not $path =~ /$cfg->{"allowed_uri"}/s
$cfg->{"allowed_uri"}
not $path =~ /$cfg->{"allowed_uri"}/s
Truth table0%0/3
A and not(B)
A= $cfg->{"allowed_uri"}B= not $path =~ /$cfg->{"allowed_uri"}/s
| |||||||||||||||||||||||||||||
| 30 | 0 | $c->log->debug("URI $path is not allowed for header authentication"); | |||||||||||||||||||||||||||
| 31 | 0 | return $c->maybe::next::method(@_); | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | if ($cfg->{auth_header} and my $sid = $c->request->header($cfg->{auth_header})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$cfg->{"auth_header"} and my $sid = $c->request->header($cfg->{"auth_header"})
MC/DC0%0/2
$cfg->{"auth_header"} and my $sid = $c->request->header($cfg->{"auth_header"})
$cfg->{"auth_header"}
my $sid = $c->request->header($cfg->{"auth_header"})
Truth table0%0/3
A and B
A= $cfg->{"auth_header"}B= my $sid = $c->request->header($cfg->{"auth_header"})
| |||||||||||||||||||||||||||||
| 35 | 0 | $c->log->debug("Header was found: $sid"); | |||||||||||||||||||||||||||
| 36 | 0 | ▶ | if (!$c->validate_session_id($sid)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | 0 | $c->log->debug("Session id, that was provided in header, is invalid"); | |||||||||||||||||||||||||||
| 38 | 0 | return $c->maybe::next::method(@_); | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | 0 | return $sid; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | 0 | return $c->maybe::next::method(@_); | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub delete_session_id { | ||||||||||||||||||||||||||
|
Subroutine
delete_session_id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 46 | 0 | my ( $c, $sid ) = @_; | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 0 | $c->maybe::next::method($sid); | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 7 | ▶ | sub uni_path { | ||||||||||||||||||||||||||
|
Subroutine
uni_path: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 53 | 7 | my ($path) = @_; | |||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 7 | ▶ | return '/' unless $path; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | 7 | $path =~ s|\/{2,}|/|gs; | |||||||||||||||||||||||||||
| 57 | 7 | $path =~ s|^\/+||s; | |||||||||||||||||||||||||||
| 58 | 7 | $path =~ s|\/+$||s; | |||||||||||||||||||||||||||
| 59 | 7 | ▶ | return '/' unless $path; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | 5 | $path = '/' . $path . '/'; | |||||||||||||||||||||||||||
| 61 | 5 | return $path; | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 2 | __PACKAGE__ | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | __END__ | ||||||||||||||||||||||||||||