| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
191687
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
75
|
|
|
2
|
1
|
|
|
1
|
|
9
|
use warnings; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
57
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package DBIx::Class::InflateColumn::Authen::Passphrase; |
|
5
|
|
|
|
|
|
|
BEGIN { |
|
6
|
1
|
|
|
1
|
|
16
|
$DBIx::Class::InflateColumn::Authen::Passphrase::AUTHORITY = 'cpan:FLORA'; |
|
7
|
|
|
|
|
|
|
} |
|
8
|
|
|
|
|
|
|
BEGIN { |
|
9
|
1
|
|
|
1
|
|
17
|
$DBIx::Class::InflateColumn::Authen::Passphrase::VERSION = '0.01'; |
|
10
|
|
|
|
|
|
|
} |
|
11
|
|
|
|
|
|
|
# ABSTRACT: Inflate/deflate columns to Authen::Passphrase instances |
|
12
|
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
551
|
use Authen::Passphrase; |
|
|
1
|
|
|
|
|
2045
|
|
|
|
1
|
|
|
|
|
28
|
|
|
14
|
1
|
|
|
1
|
|
9
|
use parent 'DBIx::Class'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
8
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub register_column { |
|
18
|
3
|
|
|
3
|
1
|
3500
|
my ($self, $column, $info, @rest) = @_; |
|
19
|
|
|
|
|
|
|
|
|
20
|
3
|
|
|
|
|
15
|
$self->next::method($column, $info, @rest); |
|
21
|
3
|
100
|
|
|
|
1422
|
return unless my $encoding = $info->{inflate_passphrase}; |
|
22
|
|
|
|
|
|
|
|
|
23
|
2
|
50
|
66
|
|
|
13
|
$self->throw_exception(q['rfc2307' and 'crypt' are the only supported types of passphrase columns]) |
|
24
|
|
|
|
|
|
|
unless $encoding eq 'rfc2307' || $encoding eq 'crypt'; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$self->inflate_column( |
|
27
|
|
|
|
|
|
|
$column => { |
|
28
|
2
|
|
|
2
|
|
15233
|
inflate => sub { Authen::Passphrase->${\"from_${encoding}"}(shift) }, |
|
|
2
|
|
|
|
|
16
|
|
|
29
|
2
|
|
|
2
|
|
169765
|
deflate => sub { shift->${\"as_${encoding}"} }, |
|
|
2
|
|
|
|
|
15
|
|
|
30
|
|
|
|
|
|
|
}, |
|
31
|
2
|
|
|
|
|
32
|
); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |
|
37
|
|
|
|
|
|
|
=pod |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=encoding utf-8 |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 NAME |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
DBIx::Class::InflateColumn::Authen::Passphrase - Inflate/deflate columns to Authen::Passphrase instances |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__PACKAGE__->load_components(qw(InflateColumn::Authen::Passphrase)); |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__PACKAGE__->add_columns( |
|
50
|
|
|
|
|
|
|
id => { |
|
51
|
|
|
|
|
|
|
data_type => 'integer', |
|
52
|
|
|
|
|
|
|
is_auto_increment => 1, |
|
53
|
|
|
|
|
|
|
}, |
|
54
|
|
|
|
|
|
|
passphrase_rfc2307 => { |
|
55
|
|
|
|
|
|
|
data_type => 'text', |
|
56
|
|
|
|
|
|
|
inflate_passphrase => 'rfc2307', |
|
57
|
|
|
|
|
|
|
}, |
|
58
|
|
|
|
|
|
|
passphrase_crypt => { |
|
59
|
|
|
|
|
|
|
data_type => 'text', |
|
60
|
|
|
|
|
|
|
inflate_passphrase => 'crypt', |
|
61
|
|
|
|
|
|
|
}, |
|
62
|
|
|
|
|
|
|
); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__PACKAGE__->set_primary_key('id'); |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
# in application code |
|
68
|
|
|
|
|
|
|
$rs->create({ passphrase_rfc2307 => Authen::Passphrase::RejectAll->new }); |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
my $row = $rs->find({ id => $id }); |
|
71
|
|
|
|
|
|
|
if ($row->passphrase_rfc2307->match($input)) { ... |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Provides inflation and deflation for Authen::Passphrase instances from and to |
|
76
|
|
|
|
|
|
|
either RFC 2307 or crypt encoding. |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
To enable both inflating and deflating, C<inflate_passphrase> must be set to a |
|
79
|
|
|
|
|
|
|
valid passhrase encoding. Currently the only supported encodings are C<rfc2307> |
|
80
|
|
|
|
|
|
|
and C<crypt>. The specified encoding will be used both when storing |
|
81
|
|
|
|
|
|
|
C<Authen::Passphrase> instances in columns, and when creating |
|
82
|
|
|
|
|
|
|
C<Authen::Passphrase> instances from columns. See L<Authen::Passphrase> for |
|
83
|
|
|
|
|
|
|
details on passphrase encodings. |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Note that not all passphrase schemes supported by C<Authen::Passphrase> can be |
|
86
|
|
|
|
|
|
|
represented in either RFC 2307 or crypt encoding. Chose the kind of passphrase |
|
87
|
|
|
|
|
|
|
encoding you're using based on the encoding the passphrase algorithms you're |
|
88
|
|
|
|
|
|
|
using support. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
When trying to encode a passphrase instance with an encoding that doesn't |
|
91
|
|
|
|
|
|
|
support it, an exception will be thrown. Similarly, when trying to load a |
|
92
|
|
|
|
|
|
|
passphrase instance from a faulty or unknown encoded representation, an |
|
93
|
|
|
|
|
|
|
exception will be thrown. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 METHODS |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head2 register_column |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Chains with the C<register_column> method in C<DBIx::Class::Row>, and sets up |
|
100
|
|
|
|
|
|
|
passphrase columns appropriately. This would not normally be directly called by |
|
101
|
|
|
|
|
|
|
end users. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 AUTHOR |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Florian Ragwitz <rafl@debian.org> |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This software is copyright (c) 2010 by Florian Ragwitz. |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
112
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut |
|
115
|
|
|
|
|
|
|
|