r12988@zaphod: kd | 2008-04-29 16:12:24 +1000
[catagits/Catalyst-Plugin-Authentication.git] / lib / Catalyst / Plugin / Authentication.pm
index e40f193..f63b753 100644 (file)
@@ -13,18 +13,6 @@ use Tie::RefHash;
 use Class::Inspector;
 use Catalyst::Authentication::Realm;
 
-# this optimization breaks under Template::Toolkit
-# use user_exists instead
-#BEGIN {
-#      require constant;
-#      constant->import(have_want => eval { require Want });
-#}
-
-## NOTE TO SELF:
-## move user persistence into realm.  
-## basically I'll provide 'persist_user' which will save the currently auth'd user.  
-## 'restore_user' which will restore the user, and 'user_is_restorable' which is a 
-## true/false on whether there is a user to restore.  
 
 our $VERSION = "0.11000";
 
@@ -306,6 +294,7 @@ sub _authentication_initialize {
             my $realmcfg = {
                 store => { class => $cfg->{'stores'}{$storename} },
             };
+            print STDERR "Foo, ok?\n";
             $app->setup_auth_realm($storename, $realmcfg);
         }
     } 
@@ -635,7 +624,7 @@ This means that our application will begin like this:
                             },
                             store => {
                                 class => 'Minimal',
-                               users = {
+                               users => {
                                    bob => {
                                        password => "s00p3r",                                       
                                        editor => 'yes',
@@ -663,8 +652,8 @@ To show an example of this, let's create an authentication controller:
     sub login : Local {
         my ( $self, $c ) = @_;
 
-        if (    my $user     = $c->req->param("user")
-            and my $password = $c->req->param("password") )
+        if (    my $user     = $c->req->params->{user}
+            and my $password = $c->req->params->{password"} )
         {
             if ( $c->authenticate( { username => $user, 
                                      password => $password } ) ) {
@@ -733,7 +722,7 @@ plugin:
     sub edit : Local {
         my ( $self, $c ) = @_;
 
-        $c->detach("unauthorized") unless $c->check_roles("edit");
+        $c->detach("unauthorized") unless $c->check_user_roles("edit");
 
         # do something restricted here
     }