doc updates
[catagits/Catalyst-Plugin-Authentication.git] / lib / Catalyst / Plugin / Authentication / Store / Minimal.pm
index 1840377..2238e2a 100644 (file)
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
 package Catalyst::Plugin::Authentication::Store::Minimal;
 
 use strict;
@@ -14,7 +12,7 @@ BEGIN {
 }
 
 sub new {
-    my ( $class, $config, $app) = @_;
+    my ( $class, $config, $app, $realm) = @_;
 
     bless { userhash => $config->{'users'} }, $class;
 }
@@ -42,6 +40,11 @@ sub find_user {
     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";
@@ -101,8 +104,7 @@ __END__
 
 =head1 NAME
 
-Catalyst::Plugin::Authentication::Store::Minimal - Minimal
-authentication store.
+Catalyst::Plugin::Authentication::Store::Minimal - Minimal authentication store
 
 =head1 SYNOPSIS
 
@@ -187,14 +189,12 @@ There are no publicly exported routines in the Minimal store (or indeed in
 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.
 
@@ -203,16 +203,14 @@ Keys the hash by the 'id' or 'username' element in the authinfo hash and returns
 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