blib/lib/Catalyst/Authentication/Store/Proxy.pm

filter: Statementstmt 38.8% 14 / 36 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 22.2% 2 / 9 Podpod 66.6% 4 / 6 totaltotal 35.7% 20 / 56 CC 3 SCAR 15.1
CC
3
Cov
35%
BUILDARGS
12.0
BUILD
2.0
_build_user_class
2.0
CRAP 4.5
↑ Summary
1 #
2 # This file is part of Catalyst-Authentication-Store-Proxy
3 #
4 # This software is Copyright (c) 2011 by Moritz Onken.
5 #
6 # This is free software, licensed under:
7 #
8 # The (three-clause) BSD License
9 #
10 package Catalyst::Authentication::Store::Proxy;
11 {
12 1 $Catalyst::Authentication::Store::Proxy::VERSION = '0.0.1';
13 }
14  
15 # ABSTRACT: Delegates authentication logic to the user object
16 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use Catalyst::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 1 has user_class => (
20 is => 'ro',
21 required => 1,
22 isa => 'Str',
23 lazy => 1,
24 builder => '_build_user_class'
25 );
26 1 has handles => ( is => 'ro', isa => 'HashRef' );
27 1 has config => ( is => 'ro', isa => 'HashRef' );
28 1 has app => ( is => 'ro', isa => 'ClassName' );
29 1 has realm => ( is => 'ro' );
30  
31 0 ▶sub BUILDARGS {
Subroutine BUILDARGS: not called CC=3 SCAR=24.8
Pod documented
32 0 my ( $class, $config, $app, $realm ) = @_;
33 my $handles = {
34 0 map { $_ => $_ } qw(from_session for_session find_user),
35 0 ▶ %{ $config->{handles} || {} },
Condition0%0/2
$config->{'handles'} || {}
l!l
00
MC/DC0%0/1
$config->{'handles'} || {}
$config->{'handles'}
Truth table0%0/2
A
A= $config->{'handles'}
Aresult
11
00
36 app => $app,
37 realm => $realm,
38 };
39 return {
40 handles => $handles,
41 app => $app,
42 realm => $realm,
43 0 ▶ $config->{user_class} ? ( user_class => $config->{user_class} ) : (),
Branch: 1 branch
BranchTrueFalseTotal
$config->{'user_class'} ? : 0 0 0
44 config => $config
45 };
46 }
47  
48 0 ▶sub BUILD {
Subroutine BUILD: not called CC=1 SCAR=6.9
Pod undocumented
49 0 my $self = shift;
50 0 Catalyst::Utils::ensure_class_loaded( $self->user_class );
51 0 return $self;
52 }
53  
54 0 ▶sub _build_user_class {
Subroutine _build_user_class: not called CC=1 SCAR=6.9
55 0 shift->app . "::User";
56 }
57  
58 0 ▶sub new_object {
Subroutine new_object: not called CC=1 SCAR=6.9
Pod undocumented
59 0 my ( $self, $c ) = @_;
60 0 return $self->user_class->new( $self->config, $c );
61 }
62  
63 0 ▶sub from_session {
Subroutine from_session: not called CC=1 SCAR=6.9
Pod documented
64 0 my ( $self, $c, $frozenuser ) = @_;
65 0 my $user = $self->new_object( $self->config, $c );
66 0 my $delegate = $self->handles->{from_session};
67 0 return $user->$delegate( $c, $frozenuser );
68 }
69  
70 0 ▶sub for_session {
Subroutine for_session: not called CC=1 SCAR=6.9
Pod documented
71 0 my ( $self, $c, $user ) = @_;
72 0 my $delegate = $self->handles->{for_session};
73 0 return $user->$delegate($c);
74 }
75  
76 0 ▶sub find_user {
Subroutine find_user: not called CC=1 SCAR=6.9
Pod documented
77 0 my ( $self, $authinfo, $c ) = @_;
78 0 my $user = $self->new_object( $self->config, $c );
79 0 my $delegate = $self->handles->{find_user};
80 0 return $user->$delegate( $authinfo, $c );
81  
82 }
83  
84 1 1;
85  
86  
87 __END__
↑ Summary