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 ) = @_;
16 bless { store => $store, user => $user }, $class;
21 return $self->user->username;
24 sub supported_features {
34 my ( $self, $password ) = @_;
35 return $self->user->check_password( $password );
40 my $field = $self->user->extra_info->[0];
41 return defined $field ? split /,/, $field : ();
52 ( my $method ) = ( our $AUTOLOAD =~ /([^:]+)$/ );
54 return if $method eq "DESTROY";
67 Catalyst::Plugin::Authentication::Store::Htpasswd::User - A user object
68 representing an entry in an htpasswd file.
72 This object wraps an L<Authen::Htpasswd::User> object. An instance of it will be returned
73 by C<< $c->user >> when using L<Catalyst::Plugin::Authentication::Store::Htpasswd>. Methods
74 not defined in this module are passed through to the L<Authen::Htpasswd::User> object. The
75 object stringifies to the username.
79 =head2 new($store,$user)
81 Creates a new object from a store object, normally an instance of
82 L<Catalyst::Plugin::Authentication::Store::Htpasswd::Backend>, and a user object,
83 normally an instance of L<Authen::Htpasswd::User>.
89 =head2 check_password($password)
91 Returns whether the password is valid.
95 Returns an array of roles, which is extracted from a comma-separated list in the
96 third field of the htpasswd file.
98 =head1 COPYRIGHT & LICENSE
100 Copyright (c) 2005 the aforementioned authors. All rights
101 reserved. This program is free software; you can redistribute
102 it and/or modify it under the same terms as Perl itself.