| 1 | package Net::HTTP::Spore::Middleware::Auth::Basic; | ||||||||||||||||||||||||||||
| 2 | 2 | $Net::HTTP::Spore::Middleware::Auth::Basic::VERSION = '0.09'; | |||||||||||||||||||||||||||
| 3 | # ABSTRACT: middleware for Basic authentication | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 2 | extends 'Net::HTTP::Spore::Middleware::Auth'; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use MIME::Base64; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 2 | has username => (isa => 'Str', is => 'rw', predicate => 'has_username'); | |||||||||||||||||||||||||||
| 11 | 2 | has password => (isa => 'Str', is => 'rw', predicate => 'has_password'); | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 1 | ▶ | sub call { | ||||||||||||||||||||||||||
|
Subroutine
call: called CC=4 SCAR=15.6
Pod
undocumented
| |||||||||||||||||||||||||||||
| 14 | 1 | my ( $self, $req ) = @_; | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 1 | ▶ | return unless $self->should_authenticate($req); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 1 | ▶ | if ( $self->has_username && $self->has_password ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->has_username and $self->has_password
MC/DC0%0/2
$self->has_username and $self->has_password
$self->has_username
$self->has_password
Truth table33%1/3
A and B
A= $self->has_usernameB= $self->has_password
| |||||||||||||||||||||||||||||
| 19 | 1 | $req->header( | |||||||||||||||||||||||||||
| 20 | 'Authorization' => 'Basic ' | ||||||||||||||||||||||||||||
| 21 | . MIME::Base64::encode( | ||||||||||||||||||||||||||||
| 22 | $self->username . ':' . $self->password, '' | ||||||||||||||||||||||||||||
| 23 | ) | ||||||||||||||||||||||||||||
| 24 | ); | ||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 2 | 1; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | __END__ | ||||||||||||||||||||||||||||