Branch Coverage

lib/PAGI/Middleware/Auth/Bearer.pm
Criterion Covered Total %
branch 25 52 48.0


line true false branch
78 0 0 unless $self->{'secret'} or $self->{'validator'}
86 0 4 if ($scope->{'type'} ne "http")
92 0 4 unless ($self->_requires_auth($scope->{'path'}))
100 1 3 unless ($auth_header)
108 0 3 unless ($token)
116 2 1 unless ($claims)
138 4 0 unless $self->{'paths'}
141 0 0 if (ref $pattern eq 'Regexp') { }
142 0 0 if $path =~ /$pattern/
144 0 0 if index($path, $pattern) == 0
153 0 3 unless $header =~ /^Bearer\s+(.+)$/i
161 0 3 if ($self->{'validator'})
173 0 3 unless @parts == 3
179 0 3 unless $header_json
181 0 3 unless $header
185 0 3 unless grep {$_ eq $alg;} @{$$self{"algorithms"};}
191 3 0 if ($alg eq 'HS256') { }
199 1 2 unless $self->_secure_compare($signature_b64, $expected_signature)
203 0 2 unless $payload_json
205 0 2 unless $claims
208 2 0 if (exists $claims->{'exp'})
209 1 1 if time > $claims->{'exp'}
213 0 1 if (exists $claims->{'nbf'})
214 0 0 if time < $claims->{'nbf'}
232 0 3 unless length $a == length $b
266 3 0 if lc $h->[0] eq $name