/usr/share/perl5/Catalyst/Authentication/Store/Htpasswd/User.pm is in libcatalyst-authentication-store-htpasswd-perl 1.003-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | #!/usr/bin/perl
package Catalyst::Authentication::Store::Htpasswd::User;
use base qw/Catalyst::Authentication::User Class::Accessor::Fast/;
use strict;
use warnings;
BEGIN { __PACKAGE__->mk_accessors(qw/_user _store/) }
use overload '""' => sub { shift->id }, fallback => 1;
sub new {
my ( $class, $store, $user ) = @_;
return unless $user;
bless { _store => $store, _user => $user }, $class;
}
sub id {
my $self = shift;
return $self->_user->username;
}
sub supported_features {
return {
password => {
self_check => 1,
},
session => 1,
roles => 1,
};
}
sub check_password {
my ( $self, $password ) = @_;
return $self->_user->check_password( $password );
}
sub roles {
my $self = shift;
my $field = $self->_user->extra_info->[0];
return defined $field ? split /,/, $field : ();
}
*for_session = \&id;
*get_object = \&_user;
sub AUTOLOAD {
my $self = shift;
( my $method ) = ( our $AUTOLOAD =~ /([^:]+)$/ );
return if $method eq "DESTROY";
$self->_user->$method;
}
1;
__END__
=pod
=head1 NAME
Catalyst::Authentication::Store::Htpasswd::User - A user object
representing an entry in an htpasswd file.
=head1 DESCRIPTION
This object wraps an L<Authen::Htpasswd::User> object. An instance of it will be returned
by C<< $c->user >> when using L<Catalyst::Authentication::Store::Htpasswd>. Methods
not defined in this module are passed through to the L<Authen::Htpasswd::User> object. The
object stringifies to the username.
=head1 METHODS
=head2 new($store,$user)
Creates a new object from a store object, normally an instance of
L<Catalyst::Plugin::Authentication::Store::Htpasswd::Backend>, and a user object,
normally an instance of L<Authen::Htpasswd::User>.
=head2 id
Returns the username.
=head2 check_password($password)
Returns whether the password is valid.
=head2 roles
Returns an array of roles, which is extracted from a comma-separated list in the
third field of the htpasswd file.
=head2 for_session
Returns the username, which is then stored in the session.
=head2 supported_features
Returns data about which featurs this user module supports.
=head2 get_object
Returns the underlieing L<Authen::Htpasswd::User> object for this user
=head1 AUTHORS
Yuval Kogman C<nothingmuch@woobling.org>
David Kamholz C<dkamholz@cpan.org>
Tomas Doran C<bobtfish@bobtfish.net>
=head1 COPYRIGHT & LICENSE
Copyright (c) 2005 the aforementioned authors. All rights
reserved. This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
=cut
|