3 package Catalyst::Authentication::Store::Htpasswd::User;
4 use base qw/Catalyst::Authentication::User Class::Accessor::Fast/;
9 our $VERSION = '1.005';
11 BEGIN { __PACKAGE__->mk_accessors(qw/_user _store/) }
13 use overload '""' => sub { shift->id }, fallback => 1;
16 my ( $class, $store, $user ) = @_;
20 bless { _store => $store, _user => $user }, $class;
25 return $self->_user->username;
28 sub supported_features {
39 my ( $self, $password ) = @_;
40 return $self->_user->check_password( $password );
45 my $field = $self->_user->extra_info->[0];
46 return defined $field ? split /,/, $field : ();
51 *get_object = \&_user;
56 ( my $method ) = ( our $AUTOLOAD =~ /([^:]+)$/ );
58 return if $method eq "DESTROY";
60 $self->_user->$method;
71 Catalyst::Authentication::Store::Htpasswd::User - A user object
72 representing an entry in an htpasswd file.
76 This object wraps an L<Authen::Htpasswd::User> object. An instance of it will be returned
77 by C<< $c->user >> when using L<Catalyst::Authentication::Store::Htpasswd>. Methods
78 not defined in this module are passed through to the L<Authen::Htpasswd::User> object. The
79 object stringifies to the username.
83 =head2 new($store,$user)
85 Creates a new object from a store object, normally an instance of
86 L<Catalyst::Authentication::Store::Htpasswd::Backend>, and a user object,
87 normally an instance of L<Authen::Htpasswd::User>.
93 =head2 check_password($password)
95 Returns whether the password is valid.
99 Returns an array of roles, which is extracted from a comma-separated list in the
100 third field of the htpasswd file.
104 Returns the username, which is then stored in the session.
106 =head2 supported_features
108 Returns data about which featurs this user module supports.
112 Returns the underlieing L<Authen::Htpasswd::User> object for this user
116 Yuval Kogman C<nothingmuch@woobling.org>
118 David Kamholz C<dkamholz@cpan.org>
120 Tomas Doran C<bobtfish@bobtfish.net>
122 =head1 COPYRIGHT & LICENSE
124 Copyright (c) 2005 the aforementioned authors. All rights
125 reserved. This program is free software; you can redistribute
126 it and/or modify it under the same terms as Perl itself.