-#!/usr/bin/perl
-
package Catalyst::Plugin::Authentication::Store::Minimal;
use strict;
}
sub new {
- my ( $class, $config, $app) = @_;
+ my ( $class, $config, $app, $realm) = @_;
bless { userhash => $config->{'users'} }, $class;
}
my $user = $self->userhash->{$id};
if ( ref $user ) {
+ if ( Scalar::Util::blessed($user)
+ and $user->isa('Catalyst::Plugin::Authentication::User::Hash') )
+ {
+ return $user;
+ }
if ( ref $user eq "HASH" ) {
$user->{id} ||= $id;
return bless $user, "Catalyst::Plugin::Authentication::User::Hash";
=head1 NAME
-Catalyst::Plugin::Authentication::Store::Minimal - Minimal
-authentication store.
+Catalyst::Plugin::Authentication::Store::Minimal - Minimal authentication store
=head1 SYNOPSIS
most authentication stores) However, below is a description of the routines
required by L<Catalyst::Plugin::Authentication> for all authentication stores.
-=over 4
-
-=item new ( $config, $app )
+=head2 new( $config, $app, $realm )
Constructs a new store object, which uses the user element of the supplied config
hash ref as it's backing structure.
-=item find_user ( $authinfo, $c )
+=head2 find_user( $authinfo, $c )
Keys the hash by the 'id' or 'username' element in the authinfo hash and returns the user.
If the return value is unblessed it will be blessed as
L<Catalyst::Plugin::Authentication::User::Hash>.
-=item from_session $id
+=head2 from_session( $id )
Delegates to C<get_user>.
-=item user_supports
+=head2 user_supports( )
Chooses a random user from the hash and delegates to it.
-=back
-
=cut