3 package Catalyst::Plugin::Authentication::User::Hash;
4 use base qw/Catalyst::Plugin::Authentication::User/;
17 ( my $key ) = ( our $AUTOLOAD =~ m/([^:]*)$/ );
19 $self->_accessor( $key, @_ );
24 $self->_accessor( "id", @_ );
37 my $arr = $self->{__hash_obj_key_is_array}{$key} = @_ > 1;
38 $self->{$key} = $arr ? [@_] : shift;
41 my $data = $self->{$key};
42 ( $self->{__hash_obj_key_is_array}{$key} || $key =~ /roles/ )
49 clear => ["password"],
50 crypted => ["crypted_password"],
51 hashed => [qw/hashed_password hash_algorithm/],
59 my ( $self, @spec ) = @_;
61 my $cursor = \%features;
63 # traverse the feature list,
65 die "bad feature spec: @spec"
66 if ref($cursor) ne "HASH";
67 $cursor = $cursor->{$_};
71 die "bad feature spec: @spec" unless ref $cursor eq "ARRAY";
73 # check that all the keys required for a feature are in here
74 foreach my $key (@$cursor) {
75 return undef unless exists $self->{$key};
87 return $self; # let's hope we're serialization happy
91 my ( $self, $c, $user ) = @_;
103 Catalyst::Plugin::Authentication::User::Hash - An easy authentication user
104 object based on hashes.
108 use Catalyst::Plugin::Authentication::User::Hash;
110 Catalyst::Plugin::Authentication::User::Hash->new(
111 password => "s3cr3t",
116 This implementation of authentication user handles is supposed to go hand in
117 hand with L<Catalyst::Plugin::Authentication::Store::Minimal>.
125 Create a new object with the key-value-pairs listed in the arg list.
129 Checks for existence of keys that correspond with features.
133 Just returns $self, expecting it to be serializable.
137 Just passes returns the unserialized object, hoping it's intact.
141 Accessor for the key whose name is the method.