Changes to Authentication to support Authentication::Store::Htpasswd
[catagits/Catalyst-Plugin-Authentication.git] / lib / Catalyst / Plugin / Authentication / User.pm
1 #!/usr/bin/perl
2
3 package Catalyst::Plugin::Authentication::User;
4
5 use strict;
6 use warnings;
7
8 sub id { die "virtual" }
9
10 sub store { die "virtual" }
11
12 sub supports {
13     my ( $self, @spec ) = @_;
14
15     my $cursor = $self->supported_features;
16
17     # traverse the feature list,
18     for (@spec) {
19         die "bad feature spec: @spec" if ref($cursor) ne "HASH";
20
21         $cursor = $cursor->{$_};
22     }
23
24     return $cursor;
25 }
26
27 __PACKAGE__;
28
29 __END__
30
31 =pod
32
33 =head1 NAME
34
35 Catalyst::Plugin::Authentication::User - Base class for user objects.
36
37 =head1 SYNOPSIS
38
39         package MyStore::User;
40         use base qw/Catalyst::Plugin::Authentication::User/;
41
42 =head1 DESCRIPTION
43
44 This is the base class for authenticated 
45
46 =head1 METHODS
47
48 =over 4
49
50 =item id
51
52 A unique ID by which a user can be retrieved from the store.
53
54 =item store
55
56 Should return a class name that can be used to refetch the user using it's
57 ID.
58
59 =item supports
60
61 An introspection method used to determine what features a user object has, to support credential and authorization plugins.
62
63 =item 
64
65 =back
66
67 =cut
68
69