| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package WWW::JSON::Role::Authentication::Basic; | 
| 2 | 8 |  |  | 8 |  | 4334 | use Moo::Role; | 
|  | 8 |  |  |  |  | 15 |  | 
|  | 8 |  |  |  |  | 47 |  | 
| 3 | 8 |  |  | 8 |  | 7033 | use MIME::Base64; | 
|  | 8 |  |  |  |  | 5274 |  | 
|  | 8 |  |  |  |  | 1753 |  | 
| 4 |  |  |  |  |  |  | requires 'authentication'; | 
| 5 |  |  |  |  |  |  | requires 'ua'; | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | sub _validate_Basic { | 
| 9 | 1 |  |  | 1 |  | 4 | my ( $self, $auth ) = @_; | 
| 10 | 1 |  |  |  |  | 4 | for (qw/username password/) { | 
| 11 | 2 | 50 |  |  |  | 41 | 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 |  |  |  |  | 25 | $req->header( Authorization => 'Basic ' | 
| 19 |  |  |  |  |  |  | . encode_base64( join( ':', @$auth{qw/username password/} ), '' ) ); | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | } | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | 1; |