[cgiapp] CAP::Auth: more details

fREW Schmidt frioux at gmail.com
Wed Mar 18 01:32:44 EDT 2009


Ok, so I had thought that CA::Dispatch was breaking CAP::Auth but apparently
I was wrong.  Here is most of my controller:

package ACD::Controller;
use strict;
use warnings;
use base qw/CGI::Application/;
use feature ':5.10';
use ACD::Model;
use CGI::Application::Plugin::AutoRunmode;
use CGI::Application::Plugin::Authentication;
use CGI::Application::Plugin::JSON ':all';

sub foo : Runmode {
    my $self = shift;
    return 'foo';
}

__PACKAGE__->authen->config(
    DRIVER => [ 'Generic', { user1 => '123' } ],
    LOGIN_RUNMODE => 'login',
);

__PACKAGE__->authen->protected_runmodes(qr/^(?!main)/);

sub login : Runmode {
    my $self = shift;
    $self->header_add( -status => '500 unauthenticated' );
    return $self->json_body({ success => 'false', reason =>
'unauthenticated'});
}

and then the app script:

#!/usr/bin/perl
use strict;
use ACD::Controller;
my $app = ACD::Controller->new();

$app->run();

And if I go to the url: http://localhost:8080/devcgi/test.plx?rm=foo

I get a 500 and the following is printed to the log:

[Wed Mar 18 00:30:01 2009] [error] No such run mode 'login' at (eval 9) line
9\n

Does anyone see what I am doing wrong?  It all looks really basic to me...

-- 
fREW Schmidt
http://blog.afoolishmanifesto.com


More information about the cgiapp mailing list