blib/lib/WWW/JSON/Role/Authentication/Basic.pm

filter: Statementstmt 100% 14 / 14 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 95.0% 19 / 20 SCAR 11.0
CC
3
Cov
94%
_validate_Basic
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« blib/lib/WWW/JSON/Role/Authentication/OAuth1.pm ↑ Summary blib/lib/WWW/JSON/Role/Authentication/Header.pm »
1 package WWW::JSON::Role::Authentication::Basic;
2 8 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 8 ▶use MIME::Base64;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 requires 'authentication';
5 8 requires 'ua';
6  
7  
8 sub _validate_Basic {
9 1 ▶ my ( $self, $auth ) = @_;
Subroutine _validate_Basic: called CC=3 SCAR=11.2
10 1 for (qw/username password/) {
11 die "Required parameter $_ missing for " . __PACKAGE__ . " authentication"
12 2 ▶ unless exists( $auth->{$_} );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $auth->{$_} 0 2 2
13 }
14 }
15  
16 sub _auth_Basic {
17 1 ▶ my ( $self, $auth, $req ) = @_;
Subroutine _auth_Basic: called CC=1 SCAR=0.0
18 $req->header( Authorization => 'Basic '
19 1 . encode_base64( join( ':', @$auth{qw/username password/} ), '' ) );
20  
21 }
22  
23 8 1;
« blib/lib/WWW/JSON/Role/Authentication/OAuth1.pm ↑ Summary blib/lib/WWW/JSON/Role/Authentication/Header.pm »