Hello monks!
I am trying to figure out what I am doing wrong, but I can't seem to find my problem. I am trying to get the hang of the Catalyst framework, and right now I am playing around with authentication. Every time I try to authenticate a login, I get the following message in the Catalyst debug output:
[error] authenticate called with nonexistant realm: 'default'.
In lib/MyApp.pm, authentication is configured as following:
__PACKAGE__->config( 'Plugin::Authentication' => { use_session => 1, default_realm => 'default', default => { credentials => { class => 'Password', password_field => 'Password', password_type => 'hashed', password_hash_type => 'SHA-1' }, store => { class => 'DBIx::Class', user_model => 'MyDB::Users', id_field => 'Username', use_userdata_from_session => 1 } } } );
And my login/authentication code is as follows:
sub base :Chained('/') :PathPart('myapp') :CaptureArgs(0) {} sub unauthenticated :Chained('base') :PathPart('authentication') :Capt +ureArgs(0) {} sub login :Chained('unauthenticated') :PathPart('login') :ActionClass( +'REST') {} sub login_POST { my $this = shift; my $c = shift; my $username = $c->request->data->{'username'} || ''; my $password = $c->request->data->{'password'} || ''; if($username eq '' || $password eq '') { $this->status_bad_request( $c, message => "Invalid username or password" ); $c->dispatch('end'); my $is_authenticated = $c->authenticate( { username => $username, password => $password } ); if(! $is_authenticated) { $this->status_bad_request( $c, message => "Invalid username or password" ); $c->dispatch('end'); } }
Any suggestion of where the error might be would be greatly appreciated.

In reply to [Catalyst] authenticate called with nonexistant realm: 'default' by mcso

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.