ported Authentication::Store::Htpasswd to Authen::Htpasswd
[catagits/Catalyst-Authentication-Store-Htpasswd.git] / lib / Catalyst / Plugin / Authentication / Store / Htpasswd / User.pm
1 #!/usr/bin/perl
2
3 package Catalyst::Plugin::Authentication::Store::Htpasswd::User;
4 use base qw/Catalyst::Plugin::Authentication::User Class::Accessor::Fast/;
5
6 use strict;
7 use warnings;
8
9 BEGIN { __PACKAGE__->mk_accessors(qw/user/) }
10
11 sub new {
12         my ( $class, $user ) = @_;
13
14         bless { user => $user }, $class;
15 }
16
17 sub supported_features {
18         return {
19                 password => {
20                         self_check => 1,
21                 }
22         };
23 }
24
25 sub check_password {
26         my ( $self, $password ) = @_;
27
28         return $self->user->check_password( $password );
29 }
30
31 sub roles {
32         my $self = shift;
33         split( ",", $self->user->extra_info );
34 }
35
36 __PACKAGE__;
37
38 __END__
39
40 =pod
41
42 =head1 NAME
43
44 Catalyst::Plugin::Authentication::Store::Htpasswd::User - A user object
45 representing an entry in an htpasswd file.
46
47 =head1 SYNOPSIS
48
49         use Catalyst::Plugin::Authentication::Store::Htpasswd::User;
50
51 =head1 DESCRIPTION
52
53 =cut
54
55