X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FPlugin%2FAuthentication%2FStore%2FHtpasswd%2FUser.pm;fp=lib%2FCatalyst%2FPlugin%2FAuthentication%2FStore%2FHtpasswd%2FUser.pm;h=dc2bd834ed44c9fcebaaeb53c00e51d0f1691991;hb=e8a7c384d5406c197382271ef873bad2883bbaf6;hp=0000000000000000000000000000000000000000;hpb=0b5b70bafb779ab4c30b593b235ce049f4cce964;p=catagits%2FCatalyst-Authentication-Store-Htpasswd.git diff --git a/lib/Catalyst/Plugin/Authentication/Store/Htpasswd/User.pm b/lib/Catalyst/Plugin/Authentication/Store/Htpasswd/User.pm new file mode 100644 index 0000000..dc2bd83 --- /dev/null +++ b/lib/Catalyst/Plugin/Authentication/Store/Htpasswd/User.pm @@ -0,0 +1,63 @@ +#!/usr/bin/perl + +package Catalyst::Plugin::Authentication::Store::Htpasswd::User; +use base qw/Catalyst::Plugin::Authentication::User Class::Accessor::Fast/; + +use strict; +use warnings; + +BEGIN { __PACKAGE__->mk_accessors(qw/file name/) } + +sub new { + my ( $class, $name, $file ) = @_; + + bless { + name => $name, + file => $file, + }, $class; +} + +sub supported_features { + return { + password => { + self_check => 1, + } + }; +} + +sub check_password { + my ( $self, $password ) = @_; + + return $self->file->htCheckPassword( $self->name, $password ); +} + +sub roles { + my $self = shift; + split( ",", $self->info_string ); +} + +sub info_string { + my $self = shift; + $self->file->fetchInfo( $self->name ); +} + +__PACKAGE__; + +__END__ + +=pod + +=head1 NAME + +Catalyst::Plugin::Authentication::Store::Htpasswd::User - A user object +representing an entry in an htpasswd file. + +=head1 SYNOPSIS + + use Catalyst::Plugin::Authentication::Store::Htpasswd::User; + +=head1 DESCRIPTION + +=cut + +