3 package Catalyst::Plugin::Authentication::Store::Htpasswd::User;
4 use base qw/Catalyst::Plugin::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 {
36 my ( $self, $password ) = @_;
37 return $self->user->check_password( $password );
42 my $field = $self->user->extra_info->[0];
43 return defined $field ? split /,/, $field : ();
54 ( my $method ) = ( our $AUTOLOAD =~ /([^:]+)$/ );
56 return if $method eq "DESTROY";
69 Catalyst::Plugin::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::Plugin::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::Plugin::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.
100 =head1 COPYRIGHT & LICENSE
102 Copyright (c) 2005 the aforementioned authors. All rights
103 reserved. This program is free software; you can redistribute
104 it and/or modify it under the same terms as Perl itself.