r10518@t0mlaptop (orig r10517): t0m | 2009-06-12 11:27:58 +0100
[catagits/Catalyst-Plugin-Authentication.git] / lib / Catalyst / Plugin / Authentication.pm
index a14b7ed..d78a63b 100644 (file)
@@ -1,16 +1,12 @@
 package Catalyst::Plugin::Authentication;
-
-use base qw/Class::Accessor::Fast/;
-
-__PACKAGE__->mk_accessors(qw/_user/);
-
-use strict;
-use warnings;
-
+use Moose::Role;
 use MRO::Compat;
 use Tie::RefHash;
 use Class::Inspector;
 use Catalyst::Authentication::Realm;
+use namespace::autoclean;
+
+has _user => ( is => 'rw' );
 
 our $VERSION = "0.10016";
 
@@ -194,14 +190,14 @@ sub auth_restore_user {
 
 }
 
-# we can't actually do our setup in setup because the model has not yet been loaded.
-# So we have to trigger off of setup_finished.  :-(
-sub setup {
+# We can't actually do our setup in setup because the model has not yet been loaded.  
+# So we have to trigger before 'setup_finalize'.
+before 'setup_finalize' => sub {
     my $app = shift;
 
+    $app->mk_classdata('_auth_initialized');
     $app->_authentication_initialize();
-    $app->next::method(@_);
-}
+};
 
 ## the actual initialization routine. whee.
 sub _authentication_initialize {