| 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
| |||||||||||||||||||||||||||||
| 20 | or return $self->ERROR(q{Missing parameter, "assoc_handle".}); | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 0 | ▶ | my $expires_in = $params->get('expires_in') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | or return $self->ERROR(q{Missing parameter, "expires_in".}); | ||||||||||||||||||||||||||||
| 24 | 0 | ▶ | unless ( $expires_in =~ /^\d+$/ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 31 | 0 | ▶ | unless ( $params->is_openid2 ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | # found session mismatch | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 0 | ▶ | if ( $params->is_openid1 && $session_type eq NO_ENCRYPTION ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$params->is_openid1 and $session_type eq "no-encryption"
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"
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 60 | or return $self->ERROR(q{Missing paramter, "assoc_type".}); | ||||||||||||||||||||||||||||
| 61 | 0 | ▶ | unless ( $self->session->can_handle_assoc_type($assoc_type) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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; | |||||||||||||||||||||||||||