Lite/RelyingParty/Associator/ParamExtractor.pm

filter: Statementstmt 47.5% 19 / 40 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 33.3% 24 / 72 CC 12 SCAR 47.0
CC
12
Cov
30%
extract_params
156.0
BEGIN
1.0
BEGIN
1.0
CRAP 110.4
« Lite/RelyingParty/IDResHandler.pm ↑ Summary Lite/Agent/Paranoid.pm »
1 package OpenID::Lite::RelyingParty::Associator::ParamExtractor;
2  
3 1 ▶use Any::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use OpenID::Lite::Association;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use OpenID::Lite::SessionHandler::NoEncryption;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use OpenID::Lite::Constants::SessionType qw(NO_ENCRYPTION);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 has 'session' => (
9 is => 'rw',
10 isa => 'OpenID::Lite::SessionHandler',
11 required => 1,
12 );
13  
14 1 with 'OpenID::Lite::Role::ErrorHandler';
15  
16 0 ▶sub extract_params {
Subroutine extract_params: not called CC=12 SCAR=50.5
Pod undocumented
17 0 my ( $self, $params ) = @_;
18  
19 0 ▶ my $assoc_handle = $params->get('assoc_handle')
Branch: 1 branch
BranchTrueFalseTotal
my $assoc_handle = $params->get("assoc_handle") or return $self->ERROR("Missing parameter, \"assoc_handle\".") 0 0 0
20 or return $self->ERROR(q{Missing parameter, "assoc_handle".});
21  
22 0 ▶ my $expires_in = $params->get('expires_in')
Branch: 1 branch
BranchTrueFalseTotal
my $expires_in = $params->get("expires_in") or return $self->ERROR("Missing parameter, \"expires_in\".") 0 0 0
23 or return $self->ERROR(q{Missing parameter, "expires_in".});
24 0 ▶ unless ( $expires_in =~ /^\d+$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expires_in =~ /^\d+$/) 0 0 0
25 0 return $self->ERROR( sprintf q{Invalid expires_in, "%s"},
26 $expires_in );
27 }
28  
29 0 my $session_type = $params->get('session_type');
30 0 ▶ unless ($session_type) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($session_type) 0 0 0
31 0 ▶ unless ( $params->is_openid2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params->is_openid2) { } 0 0 0
32 0 $session_type = NO_ENCRYPTION;
33 }
34 else {
35 0 return $self->ERROR(q{Missing parameter, "session_type"});
36 }
37 }
38  
39 0 ▶ unless ( $self->session->match($session_type) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->session->match($session_type)) 0 0 0
40  
41 # found session mismatch
42  
43 0 ▶ if ( $params->is_openid1 && $session_type eq NO_ENCRYPTION ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params->is_openid1 and $session_type eq 'no-encryption') { } 0 0 0
Condition0%0/3
$params->is_openid1 and $session_type eq "no-encryption"
!ll&&!rl&&r
000
MC/DC0%0/2
$params->is_openid1 and $session_type eq "no-encryption"
$params->is_openid1 $session_type eq "no-encryption"
Truth table0%0/3
A and B
A= $params->is_openid1B= $session_type eq "no-encryption"
ABresult
0X0
100
111
44  
45 0 my $no_encryption_handler
46 = OpenID::Lite::SessionHandler::NoEncryption->new;
47 0 $self->session($no_encryption_handler);
48  
49 }
50 else {
51 0 return $self->ERROR(
52 sprintf
53 q{Session Type Mismatch: server response includes session type "%s"},
54 $session_type
55 );
56 }
57 }
58  
59 0 ▶ my $assoc_type = $params->get('assoc_type')
Branch: 1 branch
BranchTrueFalseTotal
my $assoc_type = $params->get("assoc_type") or return $self->ERROR("Missing paramter, \"assoc_type\".") 0 0 0
60 or return $self->ERROR(q{Missing paramter, "assoc_type".});
61 0 ▶ unless ( $self->session->can_handle_assoc_type($assoc_type) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->session->can_handle_assoc_type($assoc_type)) 0 0 0
62  
63 # protocol error
64 0 return $self->ERROR(
65 sprintf q{Server responds with unsupported assoc_type, "%s" },
66 $assoc_type );
67 }
68  
69 0 ▶ my $secret = $self->session->extract_secret($params)
Branch: 1 branch
BranchTrueFalseTotal
my $secret = $self->session->extract_secret($params) or return $self->ERROR($self->session->errstr) 0 0 0
70 or return $self->ERROR( $self->session->errstr );
71  
72 0 my $association = OpenID::Lite::Association->new(
73 type => $assoc_type,
74 handle => $assoc_handle,
75 expires_in => $expires_in,
76 secret => $secret,
77 issued => time(),
78 );
79 0 return $association;
80 }
81  
82 1 ▶no Any::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
83 1 __PACKAGE__->meta->make_immutable;
84 1 1;
« Lite/RelyingParty/IDResHandler.pm ↑ Summary Lite/Agent/Paranoid.pm »