3 package Catalyst::Authentication::Store::Htpasswd::User;
4 use base qw/Catalyst::Authentication::User Class::Accessor::Fast/;
9 BEGIN { __PACKAGE__->mk_accessors(qw/_user _store/) }
11 use overload '""' => sub { shift->id }, fallback => 1;
14 my ( $class, $store, $user ) = @_;
18 bless { _store => $store, _user => $user }, $class;
23 return $self->_user->username;
26 sub supported_features {
37 my ( $self, $password ) = @_;
38 return $self->_user->check_password( $password );
43 my $field = $self->_user->extra_info->[0];
44 return defined $field ? split /,/, $field : ();
49 *get_object = \&_user;
54 ( my $method ) = ( our $AUTOLOAD =~ /([^:]+)$/ );
56 return if $method eq "DESTROY";
58 $self->_user->$method;
69 Catalyst::Authentication::Store::Htpasswd::User - A user object
70 representing an entry in an htpasswd file.
74 This object wraps an L<Authen::Htpasswd::User> object. An instance of it will be returned
75 by C<< $c->user >> when using L<Catalyst::Authentication::Store::Htpasswd>. Methods
76 not defined in this module are passed through to the L<Authen::Htpasswd::User> object. The
77 object stringifies to the username.
81 =head2 new($store,$user)
83 Creates a new object from a store object, normally an instance of
84 L<Catalyst::Authentication::Store::Htpasswd::Backend>, and a user object,
85 normally an instance of L<Authen::Htpasswd::User>.
91 =head2 check_password($password)
93 Returns whether the password is valid.
97 Returns an array of roles, which is extracted from a comma-separated list in the
98 third field of the htpasswd file.
102 Returns the username, which is then stored in the session.
104 =head2 supported_features
106 Returns data about which featurs this user module supports.
110 Returns the underlieing L<Authen::Htpasswd::User> object for this user
114 Yuval Kogman C<nothingmuch@woobling.org>
116 David Kamholz C<dkamholz@cpan.org>
118 Tomas Doran C<bobtfish@bobtfish.net>
120 =head1 COPYRIGHT & LICENSE
122 Copyright (c) 2005 the aforementioned authors. All rights
123 reserved. This program is free software; you can redistribute
124 it and/or modify it under the same terms as Perl itself.