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