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";
my $realmcfg = {
store => { class => $cfg->{'stores'}{$storename} },
};
+ print STDERR "Foo, ok?\n";
$app->setup_auth_realm($storename, $realmcfg);
}
}
},
store => {
class => 'Minimal',
- users = {
+ users => {
bob => {
password => "s00p3r",
editor => 'yes',
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 } ) ) {
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
}