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 || return )->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 : ();
55 ( my $method ) = ( our $AUTOLOAD =~ /([^:]+)$/ );
57 return if $method eq "DESTROY";
70 Catalyst::Plugin::Authentication::Store::Htpasswd::User - A user object
71 representing an entry in an htpasswd file.
75 This object wraps an L<Authen::Htpasswd::User> object. An instance of it will be returned
76 by C<< $c->user >> when using L<Catalyst::Plugin::Authentication::Store::Htpasswd>. Methods
77 not defined in this module are passed through to the L<Authen::Htpasswd::User> object. The
78 object stringifies to the username.
82 =head2 new($store,$user)
84 Creates a new object from a store object, normally an instance of
85 L<Catalyst::Plugin::Authentication::Store::Htpasswd::Backend>, and a user object,
86 normally an instance of L<Authen::Htpasswd::User>.
92 =head2 check_password($password)
94 Returns whether the password is valid.
98 Returns an array of roles, which is extracted from a comma-separated list in the
99 third field of the htpasswd file.
101 =head1 COPYRIGHT & LICENSE
103 Copyright (c) 2005 the aforementioned authors. All rights
104 reserved. This program is free software; you can redistribute
105 it and/or modify it under the same terms as Perl itself.