| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::JSON::Role::Authentication::Basic; |
|
2
|
8
|
|
|
8
|
|
3258
|
use Moo::Role; |
|
|
8
|
|
|
|
|
10
|
|
|
|
8
|
|
|
|
|
41
|
|
|
3
|
8
|
|
|
8
|
|
5563
|
use MIME::Base64; |
|
|
8
|
|
|
|
|
4482
|
|
|
|
8
|
|
|
|
|
1347
|
|
|
4
|
|
|
|
|
|
|
requires 'authentication'; |
|
5
|
|
|
|
|
|
|
requires 'ua'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub _validate_Basic { |
|
9
|
1
|
|
|
1
|
|
3
|
my ( $self, $auth ) = @_; |
|
10
|
1
|
|
|
|
|
3
|
for (qw/username password/) { |
|
11
|
2
|
50
|
|
|
|
23
|
die "Required parameter $_ missing for " . __PACKAGE__ . " authentication" |
|
12
|
|
|
|
|
|
|
unless exists( $auth->{$_} ); |
|
13
|
|
|
|
|
|
|
} |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _auth_Basic { |
|
17
|
1
|
|
|
1
|
|
2
|
my ( $self, $auth, $req ) = @_; |
|
18
|
1
|
|
|
|
|
15
|
$req->header( Authorization => 'Basic ' |
|
19
|
|
|
|
|
|
|
. encode_base64( join( ':', @$auth{qw/username password/} ), '' ) ); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |