| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MooseX::Types::Authen::Passphrase; |
|
2
|
|
|
|
|
|
|
BEGIN { |
|
3
|
1
|
|
|
1
|
|
53304
|
$MooseX::Types::Authen::Passphrase::AUTHORITY = 'cpan:NUFFIN'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
|
|
|
|
|
|
# git description: v0.03-2-gbdb4541 |
|
6
|
|
|
|
|
|
|
$MooseX::Types::Authen::Passphrase::VERSION = '0.04'; |
|
7
|
|
|
|
|
|
|
# ABSTRACT: L<Authen::Passphrase> type constraint and coercions |
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
17
|
|
|
10
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
27
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
267
|
use Authen::Passphrase; |
|
|
1
|
|
|
|
|
3543
|
|
|
|
1
|
|
|
|
|
42
|
|
|
13
|
1
|
|
|
1
|
|
373
|
use Authen::Passphrase::RejectAll; |
|
|
1
|
|
|
|
|
1318
|
|
|
|
1
|
|
|
|
|
44
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
358
|
use MooseX::Types::Moose qw(Str Undef); |
|
|
1
|
|
|
|
|
501111
|
|
|
|
1
|
|
|
|
|
15
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
8186
|
use MooseX::Types -declare => [qw(Passphrase)]; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
8
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
7022
|
use namespace::clean; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
7
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
class_type "Authen::Passphrase"; |
|
22
|
|
|
|
|
|
|
class_type Passphrase, { class => "Authen::Passphrase" }; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
foreach my $type ( "Authen::Passphrase", Passphrase ) { |
|
25
|
|
|
|
|
|
|
coerce( $type, |
|
26
|
|
|
|
|
|
|
from Undef, via { Authen::Passphrase::RejectAll->new }, |
|
27
|
|
|
|
|
|
|
from Str, via { |
|
28
|
|
|
|
|
|
|
if ( /^\{/ ) { |
|
29
|
|
|
|
|
|
|
return Authen::Passphrase->from_rfc2307($_); |
|
30
|
|
|
|
|
|
|
} else { |
|
31
|
|
|
|
|
|
|
return Authen::Passphrase->from_crypt($_); |
|
32
|
|
|
|
|
|
|
#my ( $p, $e ) = do { local $@; my $p = eval { Authen::Passphrase->from_crypt($_) }; ( $p, $@ ) }; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#if ( ref $p and $p->isa("Authen::Passphrase::RejectAll") and length($_) ) { |
|
35
|
|
|
|
|
|
|
# warn "e: $e"; |
|
36
|
|
|
|
|
|
|
# return Authen::Passphrase::Clear->new($_); |
|
37
|
|
|
|
|
|
|
#} elsif ( $e ) { |
|
38
|
|
|
|
|
|
|
# die $e; |
|
39
|
|
|
|
|
|
|
#} else { |
|
40
|
|
|
|
|
|
|
# return $p; |
|
41
|
|
|
|
|
|
|
#} |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
}, |
|
44
|
|
|
|
|
|
|
); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__PACKAGE__ |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=pod |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=encoding UTF-8 |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 NAME |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
MooseX::Types::Authen::Passphrase - L<Authen::Passphrase> type constraint and coercions |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 VERSION |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
version 0.04 |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
package User; |
|
66
|
|
|
|
|
|
|
use Moose; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
use MooseX::Types::Authen::Passphrase qw(Passphrase); |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
has pass => ( |
|
71
|
|
|
|
|
|
|
isa => Passphrase, |
|
72
|
|
|
|
|
|
|
coerce => 1, |
|
73
|
|
|
|
|
|
|
handles => { check_password => "match" }, |
|
74
|
|
|
|
|
|
|
); |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
User->new( pass => undef ); # Authen::Passphrase::RejectAll |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
my $u = User->new( pass => "{SSHA}ixZcpJbwT507Ch1IRB0KjajkjGZUMzX8gA==" ); |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
$u->check_password("foo"); # great success |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
User->new( pass => Authen::Passphrase::Clear->new("foo") ); # clear text is not coerced by default |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This L<MooseX::Types> library provides string coercions for the |
|
87
|
|
|
|
|
|
|
L<Authen::Passphrase> family of classes. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 TYPES |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 C<Authen::Passphrase>, C<Passphrase> |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
These are defined a class types. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
The following coercions are defined: |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=over 4 |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item from C<Undef> |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Returns L<Authen::Passphrase::RejectAll> |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item from C<Str> |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Parses using C<from_rfc2307> if the string begins with a C<{>, or using |
|
106
|
|
|
|
|
|
|
C<from_crypt> otherwise. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=back |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 AUTHOR |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
×××× ×§××'×× (Yuval Kogman) <nothingmuch@woobling.org> |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This software is copyright (c) 2008 by Yuval Kogman. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
119
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=for stopwords Brian Fraser Karen Etheridge Yuval Kogman |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=over 4 |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item * |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Brian Fraser <fraserbn@gmail.com> |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item * |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item * |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Yuval Kogman <nothingmuch@woobling.org> |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=back |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |