3 package Catalyst::Authentication::Store::Htpasswd::User;
4 # ABSTRACT: A user object representing an entry in an htpasswd file.
6 use base qw/Catalyst::Authentication::User Class::Accessor::Fast/;
11 our $VERSION = '1.005';
13 BEGIN { __PACKAGE__->mk_accessors(qw/_user _store/) }
15 use overload '""' => sub { shift->id }, fallback => 1;
18 my ( $class, $store, $user ) = @_;
22 bless { _store => $store, _user => $user }, $class;
27 return $self->_user->username;
30 sub supported_features {
41 my ( $self, $password ) = @_;
42 return $self->_user->check_password( $password );
47 my $field = $self->_user->extra_info->[0];
48 return defined $field ? split /,/, $field : ();
53 *get_object = \&_user;
58 ( my $method ) = ( our $AUTOLOAD =~ /([^:]+)$/ );
60 return if $method eq "DESTROY";
62 $self->_user->$method;
73 This object wraps an L<Authen::Htpasswd::User> object. An instance of it will be returned
74 by C<< $c->user >> when using L<Catalyst::Authentication::Store::Htpasswd>. Methods
75 not defined in this module are passed through to the L<Authen::Htpasswd::User> object. The
76 object stringifies to the username.
80 =head2 new($store,$user)
82 Creates a new object from a store object, normally an instance of
83 L<Catalyst::Authentication::Store::Htpasswd::Backend>, and a user object,
84 normally an instance of L<Authen::Htpasswd::User>.
90 =head2 check_password($password)
92 Returns whether the password is valid.
96 Returns an array of roles, which is extracted from a comma-separated list in the
97 third field of the htpasswd file.
101 Returns the username, which is then stored in the session.
103 =head2 supported_features
105 Returns data about which featurs this user module supports.
109 Returns the underlieing L<Authen::Htpasswd::User> object for this user