Commit | Line | Data |
---|---|---|
e8a7c384 | 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 | ||
3e0bbcff | 9 | BEGIN { __PACKAGE__->mk_accessors(qw/user/) } |
e8a7c384 | 10 | |
47fb088e | 11 | use overload '""' => sub { shift->user->username }; |
12 | ||
e8a7c384 | 13 | sub new { |
3e0bbcff | 14 | my ( $class, $user ) = @_; |
e8a7c384 | 15 | |
3e0bbcff | 16 | bless { user => $user }, $class; |
e8a7c384 | 17 | } |
18 | ||
19 | sub supported_features { | |
20 | return { | |
21 | password => { | |
22 | self_check => 1, | |
47fb088e | 23 | }, |
24 | session => 1 | |
e8a7c384 | 25 | }; |
26 | } | |
27 | ||
28 | sub check_password { | |
29 | my ( $self, $password ) = @_; | |
30 | ||
3e0bbcff | 31 | return $self->user->check_password( $password ); |
e8a7c384 | 32 | } |
33 | ||
34 | sub roles { | |
35 | my $self = shift; | |
3e0bbcff | 36 | split( ",", $self->user->extra_info ); |
e8a7c384 | 37 | } |
38 | ||
47fb088e | 39 | sub for_session { |
40 | my $self = shift; | |
41 | return $self; | |
42 | } | |
43 | ||
44 | sub from_session { | |
45 | my ($class,$c,$user) = @_; | |
46 | return $user; | |
47 | } | |
48 | ||
e8a7c384 | 49 | __PACKAGE__; |
50 | ||
51 | __END__ | |
52 | ||
53 | =pod | |
54 | ||
55 | =head1 NAME | |
56 | ||
57 | Catalyst::Plugin::Authentication::Store::Htpasswd::User - A user object | |
58 | representing an entry in an htpasswd file. | |
59 | ||
60 | =head1 SYNOPSIS | |
61 | ||
62 | use Catalyst::Plugin::Authentication::Store::Htpasswd::User; | |
63 | ||
64 | =head1 DESCRIPTION | |
65 | ||
66 | =cut | |
67 | ||
68 |