« 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
| |||||||||||
| 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; | |||||||||