Moving AuthRealmTestApp.pm to proper directory
Matt S Trout [Tue, 17 Jul 2007 16:59:27 +0000 (16:59 +0000)]
Correcting backwards compatibility bug with $user->store()
thanks to nilsonsfj for finding this bug
r53846@cain (orig r6511):  jayk | 2007-07-07 02:05:09 +0000

lib/Catalyst/Plugin/Authentication.pm
lib/Catalyst/Plugin/Authentication/User.pm
t/lib/AuthRealmTestApp.pm [moved from t/AuthRealmTestApp.pm with 100% similarity]

index 7e2f917..62320c6 100644 (file)
@@ -40,6 +40,7 @@ sub set_authenticated {
         $c->save_user_in_session($user, $realmname);
     }
     $user->auth_realm($realmname);
+    $user->store(ref($c->auth_realms->{$realmname}{'store'}));
     
     $c->NEXT::set_authenticated($user, $realmname);
 }
@@ -167,6 +168,10 @@ sub auth_restore_user {
     
     # this sets the realm the user originated in.
     $user->auth_realm($realmname);
+    ## compatibility - some pre 0.10 store / credentials may need the store name,
+    ## this is not used by the current api in any form.
+    $user->store(ref($c->auth_realms->{$realmname}{'store'}));
+    
     return $user;
 
 }
index b12f848..025b654 100644 (file)
@@ -8,7 +8,7 @@ use base qw/Class::Accessor::Fast/;
 
 ## auth_realm is the realm this user came from. 
 BEGIN {
-    __PACKAGE__->mk_accessors(qw/auth_realm/);
+    __PACKAGE__->mk_accessors(qw/auth_realm store/);
 }
 
 ## THIS IS NOT A COMPLETE CLASS! it is intended to provide base functionality only.  
@@ -68,10 +68,11 @@ sub get_object {
 
 ## Backwards Compatibility
 ## you probably want auth_realm, in fact.  but this does work for backwards compatibility.
-sub store { 
-    my ($self) = @_;
-    return $self->auth_realm->{store};
-}
+## store should be a read-write accessor - so it was moved to mk_accessors
+##sub store { 
+##    my ($self) = @_;
+##    return $self->auth_realm->{store};
+##}
 
 __PACKAGE__;