line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Catalyst::Authentication::Store::Htpasswd::User; |
4
|
|
|
|
|
|
|
# ABSTRACT: A user object representing an entry in an htpasswd file. |
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
24
|
use base qw/Catalyst::Authentication::User Class::Accessor::Fast/; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
1557
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
1333185
|
use strict; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
73
|
|
9
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
186
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '1.006'; |
12
|
|
|
|
|
|
|
|
13
|
4
|
|
|
4
|
|
41
|
BEGIN { __PACKAGE__->mk_accessors(qw/_user _store/) } |
14
|
|
|
|
|
|
|
|
15
|
4
|
|
|
4
|
|
28023
|
use overload '""' => sub { shift->id }, fallback => 1; |
|
4
|
|
|
2
|
|
11
|
|
|
4
|
|
|
|
|
34
|
|
|
2
|
|
|
|
|
15774
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
18
|
4
|
|
|
4
|
1
|
50
|
my ( $class, $store, $user ) = @_; |
19
|
|
|
|
|
|
|
|
20
|
4
|
50
|
|
|
|
52
|
return unless $user; |
21
|
|
|
|
|
|
|
|
22
|
4
|
|
|
|
|
48
|
bless { _store => $store, _user => $user }, $class; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub id { |
26
|
4
|
|
|
4
|
1
|
2025
|
my $self = shift; |
27
|
4
|
|
|
|
|
21
|
return $self->_user->username; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub supported_features { |
31
|
|
|
|
|
|
|
return { |
32
|
4
|
|
|
4
|
1
|
70
|
password => { |
33
|
|
|
|
|
|
|
self_check => 1, |
34
|
|
|
|
|
|
|
}, |
35
|
|
|
|
|
|
|
session => 1, |
36
|
|
|
|
|
|
|
roles => 1, |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub check_password { |
41
|
3
|
|
|
3
|
1
|
1341
|
my ( $self, $password ) = @_; |
42
|
3
|
|
|
|
|
17
|
return $self->_user->check_password( $password ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub roles { |
46
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
47
|
0
|
|
|
|
|
0
|
my $field = $self->_user->extra_info->[0]; |
48
|
0
|
0
|
|
|
|
0
|
return defined $field ? split /,/, $field : (); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
*for_session = \&id; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
*get_object = \&_user; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub AUTOLOAD { |
56
|
2
|
|
|
2
|
|
136
|
my $self = shift; |
57
|
|
|
|
|
|
|
|
58
|
2
|
|
|
|
|
16
|
( my $method ) = ( our $AUTOLOAD =~ /([^:]+)$/ ); |
59
|
|
|
|
|
|
|
|
60
|
2
|
50
|
|
|
|
10
|
return if $method eq "DESTROY"; |
61
|
|
|
|
|
|
|
|
62
|
2
|
|
|
|
|
7
|
$self->_user->$method; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=pod |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=encoding UTF-8 |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 NAME |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Catalyst::Authentication::Store::Htpasswd::User - A user object representing an entry in an htpasswd file. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 VERSION |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
version 1.006 |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 DESCRIPTION |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
This object wraps an L<Authen::Htpasswd::User> object. An instance of it will be returned |
84
|
|
|
|
|
|
|
by C<< $c->user >> when using L<Catalyst::Authentication::Store::Htpasswd>. Methods |
85
|
|
|
|
|
|
|
not defined in this module are passed through to the L<Authen::Htpasswd::User> object. The |
86
|
|
|
|
|
|
|
object stringifies to the username. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 METHODS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 new($store,$user) |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Creates a new object from a store object, normally an instance of |
93
|
|
|
|
|
|
|
L<Catalyst::Plugin::Authentication::Store::Htpasswd::Backend>, and a user object, |
94
|
|
|
|
|
|
|
normally an instance of L<Authen::Htpasswd::User>. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 id |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Returns the username. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 check_password($password) |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Returns whether the password is valid. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 roles |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Returns an array of roles, which is extracted from a comma-separated list in the |
107
|
|
|
|
|
|
|
third field of the htpasswd file. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head2 for_session |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Returns the username, which is then stored in the session. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 supported_features |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Returns data about which featurs this user module supports. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head2 get_object |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Returns the underlieing L<Authen::Htpasswd::User> object for this user |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 SUPPORT |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Authentication-Store-Htpasswd> |
124
|
|
|
|
|
|
|
(or L<bug-Catalyst-Authentication-Store-Htpasswd@rt.cpan.org|mailto:bug-Catalyst-Authentication-Store-Htpasswd@rt.cpan.org>). |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
There is also a mailing list available for users of this distribution, at |
127
|
|
|
|
|
|
|
L<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst>. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
130
|
|
|
|
|
|
|
L<C<#catalyst> on C<irc.perl.org>|irc://irc.perl.org/#catalyst>. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 AUTHOR |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
×××× ×§××'×× (Yuval Kogman) <nothingmuch@woobling.org> |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This software is copyright (c) 2005 by ×××× ×§××'×× (Yuval Kogman). |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
141
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |