3 package Catalyst::Plugin::Authentication::Store::Minimal::Backend;
8 use Catalyst::Plugin::Authentication::User::Hash;
12 my ( $class, $hash ) = @_;
14 bless { hash => $hash }, $class;
18 my ( $self, $id ) = @_;
20 my $user = $self->{hash}{$id};
22 bless $user, "Catalyst::Plugin::Authentication::User::Hash"
23 unless Scalar::Util::blessed($user);
31 # choose a random user
32 scalar keys %{ $self->{hash} };
33 ( undef, my $user ) = each %{ $self->{hash} };
46 Catalyst::Plugin::Authentication::Store::Minimal::Backend - Minimal
47 authentication storage backend.
51 # you probably just want Store::Minimal under most cases,
52 # but if you insist you can instantiate your own store:
54 use Catalyst::Plugin::Authentication::Store::Minimal::Backend;
58 Authentication::Credential::Password
62 user => { password => "s3cr3t" },
65 our $users = Catalyst::Plugin::Authentication::Store::Minimal::Backend->new(\%users);
68 my ( $self, $c ) = @_;
70 $c->login( $users->get_user( $c->req->param("login") ),
71 $c->req->param("password") );
76 You probably want L<Catalyst::Plugin::Authentication::Store::Minimal>, unless
77 you are mixing several stores in a single app and one of them is Minimal.
79 Otherwise, this lets you create a store manually.
87 Constructs a new store object, which uses the supplied hash ref as it's backing
92 Keys the hash by $id and returns the value.
94 If the return value is unblessed it will be blessed as
95 L<Catalyst::Plugin::Authentication::User::Hash>.
99 Chooses a random user from the hash and delegates to it.