File Coverage

blib/lib/OpenID/Lite/RelyingParty/Associator.pm
Criterion Covered Total %
statement 4 6 66.6
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 6 8 75.0


line stmt bran cond sub pod time code
1             package OpenID::Lite::RelyingParty::Associator;
2              
3 1     1   7 use Any::Moose;
  1         2  
  1         10  
4             with 'OpenID::Lite::Role::ErrorHandler';
5             with 'OpenID::Lite::Role::AgentHandler';
6             with 'OpenID::Lite::Role::Associator';
7              
8 1     1   829 use OpenID::Lite::SessionHandlers;
  0            
  0            
9             use OpenID::Lite::RelyingParty::Associator::Base;
10             use Carp ();
11              
12             sub associate {
13             my ( $self, $service ) = @_;
14              
15             my $associator = $self->create_method_for( $self->session_type );
16             my $association = $associator->associate($service)
17             or return $self->ERROR( $associator->errstr );
18             return $association;
19             }
20              
21             # factory method
22             sub create_method_for {
23             my ( $self, $type ) = @_;
24             my $session = OpenID::Lite::SessionHandlers->select_session($type);
25             Carp::croak "invalid session type" unless $session;
26             my $associator = OpenID::Lite::RelyingParty::Associator::Base->new(
27             agent => $self->agent,
28             assoc_type => $self->assoc_type,
29             session => $session,
30             );
31             return $associator;
32             }
33              
34             no Any::Moose;
35             __PACKAGE__->meta->make_immutable;
36             1;
37