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