X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FPlugin%2FAuthentication.pm;h=f63b7532aa13ec68a7bd457bd4f8d19899590895;hb=99235d31591677a9350e3e868ca7448cc885b662;hp=e40f19355b7ee295938c891f11617ca3c59a8490;hpb=71486cb03d6cf82b0f6e472e08738f0aeb064662;p=catagits%2FCatalyst-Plugin-Authentication.git diff --git a/lib/Catalyst/Plugin/Authentication.pm b/lib/Catalyst/Plugin/Authentication.pm index e40f193..f63b753 100644 --- a/lib/Catalyst/Plugin/Authentication.pm +++ b/lib/Catalyst/Plugin/Authentication.pm @@ -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 }