line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
2
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package # hide from PAUSE |
5
|
|
|
|
|
|
|
RapidApp::DBIC::Component::PassphraseColumn; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# Temp copy of DBIx::Class::PassphraseColumn with fix for null columns. |
8
|
|
|
|
|
|
|
# will stop using this as soon as the real module merges that fix |
9
|
|
|
|
|
|
|
# https://github.com/rafl/dbix-class-passphrasecolumn/pull/3 |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use Class::Load 'load_class'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
62
|
|
12
|
1
|
|
|
1
|
|
8
|
use Sub::Name 'subname'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
50
|
|
13
|
1
|
|
|
1
|
|
7
|
use namespace::clean; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
104
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
196
|
use parent 'DBIx::Class'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
__PACKAGE__->load_components(qw(InflateColumn::Authen::Passphrase)); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
__PACKAGE__->mk_classdata('_passphrase_columns'); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub register_column { |
23
|
7
|
|
|
7
|
1
|
3456
|
my ($self, $column, $info, @rest) = @_; |
24
|
|
|
|
|
|
|
|
25
|
7
|
100
|
|
|
|
22
|
if (my $encoding = $info->{passphrase}) { |
26
|
1
|
|
|
|
|
2
|
$info->{inflate_passphrase} = $encoding; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
$self->throw_exception(q['passphrase_class' is a required argument]) |
29
|
|
|
|
|
|
|
unless exists $info->{passphrase_class} |
30
|
1
|
50
|
33
|
|
|
7
|
&& defined $info->{passphrase_class}; |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
3
|
my $class = 'Authen::Passphrase::' . $info->{passphrase_class}; |
33
|
1
|
|
|
|
|
6
|
load_class $class; |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
50
|
|
|
20745
|
my $args = $info->{passphrase_args} || {}; |
36
|
1
|
50
|
|
|
|
6
|
$self->throw_exception(q['passphrase_args' must be a hash reference]) |
37
|
|
|
|
|
|
|
unless ref $args eq 'HASH'; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $encoder = sub { |
40
|
3
|
|
|
3
|
|
13
|
my ($val) = @_; |
41
|
3
|
|
|
|
|
8
|
$class->new(%{ $args }, passphrase => $val)->${\"as_${encoding}"}; |
|
3
|
|
|
|
|
40
|
|
|
3
|
|
|
|
|
165756
|
|
42
|
1
|
|
|
|
|
5
|
}; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$self->_passphrase_columns({ |
45
|
1
|
50
|
|
|
|
3
|
%{ $self->_passphrase_columns || {} }, |
|
1
|
|
|
|
|
42
|
|
46
|
|
|
|
|
|
|
$column => $encoder, |
47
|
|
|
|
|
|
|
}); |
48
|
|
|
|
|
|
|
|
49
|
1
|
50
|
|
|
|
180
|
if (defined(my $meth = $info->{passphrase_check_method})) { |
50
|
|
|
|
|
|
|
my $checker = sub { |
51
|
5
|
|
|
5
|
|
27120
|
my ($row, $val) = @_; |
|
|
|
|
5
|
|
|
|
52
|
5
|
50
|
|
|
|
107
|
my $ppr = $row->get_inflated_column($column) or return 0; |
53
|
5
|
|
|
|
|
2042
|
return $ppr->match($val); |
54
|
1
|
|
|
|
|
6
|
}; |
55
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
31
|
my $name = join q[::] => $self->result_class, $meth; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
{ |
59
|
1
|
|
|
1
|
|
333
|
no strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
253
|
|
|
1
|
|
|
|
|
597
|
|
60
|
1
|
|
|
|
|
45
|
*$name = subname $name => $checker; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
7
|
|
|
|
|
24
|
$self->next::method($column, $info, @rest); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub set_column { |
69
|
9
|
|
|
9
|
0
|
153
|
my ($self, $col, $val, @rest) = @_; |
70
|
|
|
|
|
|
|
|
71
|
9
|
|
|
|
|
263
|
my $ppr_cols = $self->_passphrase_columns; |
72
|
|
|
|
|
|
|
return $self->next::method($col, $ppr_cols->{$col}->($val), @rest) |
73
|
9
|
100
|
|
|
|
533
|
if exists $ppr_cols->{$col}; |
74
|
|
|
|
|
|
|
|
75
|
6
|
|
|
|
|
38
|
return $self->next::method($col, $val, @rest); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub new { |
79
|
1
|
|
|
1
|
0
|
21
|
my ($self, $attr, @rest) = @_; |
80
|
|
|
|
|
|
|
|
81
|
1
|
|
|
|
|
29
|
my $ppr_cols = $self->_passphrase_columns; |
82
|
1
|
|
|
|
|
34
|
for my $col (keys %{ $ppr_cols }) { |
|
1
|
|
|
|
|
5
|
|
83
|
1
|
50
|
33
|
|
|
5
|
next unless exists $attr->{$col} && !ref $attr->{$col}; |
84
|
0
|
|
|
|
|
0
|
$attr->{$col} = $ppr_cols->{$col}->( $attr->{$col} ); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
1
|
|
|
|
|
5
|
return $self->next::method($attr, @rest); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |