| blib/lib/Mojolicious/Plugin/HttpBasicAuth.pm | |||
|---|---|---|---|
| Criterion | Covered | Total | % |
| condition | 12 | 19 | 63.1 |
| line | !l | l&&!r | l&&r | condition |
|---|---|---|---|---|
| 41 | 0 | 12 | 4 | $options{'validate'} and $options{'validate'}($controller, split(/:/, $auth, 2), $options{'realm'}) |
| 54 | 2 | 0 | 16 | $auth and $auth =~ /Basic (.*)/ |
| line | l | !l | condition |
|---|---|---|---|
| 15 | 0 | 1 | $defaults{'realm'} //= 'WWW' |
| 18 | 1 | 0 | $defaults{'validate'} //= sub { die 'please define a validate callback'; } |
| 26 | 0 | 1 | $defaults{'invalid'} //= sub { my $controller = shift(); return 'json', {'json', {'error', 'HTTP 401: Unauthorized'}}, 'html', {'template', 'auth/basic'}, 'any', {'data', 'HTTP 401: Unauthorized'}; } |
| 31 | 0 | 18 | shift() // {} |
| 35 | 16 | 2 | $plugin->_auth_header($controller) || '' |
| line | l | !l&&r | !l&&!r | condition |
|---|---|---|---|---|
| 52 | 16 | 0 | 2 | $controller->req->headers->authorization || $controller->req->env->{'X_HTTP_AUTHORIZATION'} || $controller->req->env->{'HTTP_AUTHORIZATION'} |