Dancer2::Plugin::Auth::Extensible problem - likely me
I'm trying to play with Authentication in Dancer2, and I can't get the dang example from Gabor at his blog (http://perlmaven.com/password-protecting-web-pages-in-dancer2) to run, it keeps giving me the following error: No Auth::Extensible realms configured with which to authenticate user at /home/stoffj/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Dancer2/Plugin/Auth/Extensible.pm line 1160. HTTP::Server::PSGI: Accepting connections at http://0:5000/ And I'm going a little crazy. I'm using a perlbrew interpretter on CentOS 6.7, runnning perl 5.14.2, with all the latest modules installed.
From looking at the Extensible.pm file, it's warning from the on_plugin_import() sub where it's looking for Realms.
I've got the following config.yml file setup: show_errors: 1 session: "YAML" logger: console log: core plugins: Auth::Extensible: realms: config: provider: Config users: - user: 'foo' pass: 'bar' name: 'George Foo' roles: - Marketing - user: 'bar' pass: 'foo' name: 'George Bar' roles: - Testing - Marketing - Management And my app.pl looks like this: #!perl # use strict; use Dancer2; use Dancer2::Plugin::Auth::Extensible; get '/' => sub { return 'This is a public page. Everyone can see it. Check out the <a href="/report">report</a>'; }; get '/report' => require_role Marketing => sub { return 'Only authenticated users should be able to see this page'; }; dance; And I'm invoking it like this: ~/tmp/Dancer2> ../../perl5/perlbrew/perls/perl-5.14.2/bin/plackup -R . app.pl Watching . ./lib app.pl for file updates. No Auth::Extensible realms configured with which to authenticate user at /home/stoffj/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Dancer2/Plugin/Auth/Extensible.pm line 1160. HTTP::Server::PSGI: Accepting connections at http://0:5000/ So does anyone see what I'm going wrong here? Thanks, John
On Fri, 2015-12-04 at 16:37 -0500, John Stoffel wrote:
I'm trying to play with Authentication in Dancer2, and I can't get the dang example from Gabor at his blog (http://perlmaven.com/password-protecting-web-pages-in-dancer2) to run, it keeps giving me the following error:
No Auth::Extensible realms configured with which to authenticate user
Your example works for me. Are you sure the app is reading your config at all? Try dumping config() from a route, and checking whether it contains your configuration (bear in mind that it will still contain default information if your config isn't being read). If it is, also check that the dump contains your Auth::Extensible config. Andy
Hi John, Instead of following command: plackup -R . app.pl Would you please try following and write result? perl app.pl And as I understand from your message, you get warning not error, because it says that : HTTP::Server::PSGI: Accepting connections at http://0:5000/ On Fri, Dec 4, 2015 at 11:50 PM, Andrew Beverley <andy@andybev.com> wrote:
On Fri, 2015-12-04 at 16:37 -0500, John Stoffel wrote:
I'm trying to play with Authentication in Dancer2, and I can't get the dang example from Gabor at his blog (http://perlmaven.com/password-protecting-web-pages-in-dancer2) to run, it keeps giving me the following error:
No Auth::Extensible realms configured with which to authenticate user
Your example works for me. Are you sure the app is reading your config at all?
Try dumping config() from a route, and checking whether it contains your configuration (bear in mind that it will still contain default information if your config isn't being read).
If it is, also check that the dump contains your Auth::Extensible config.
Andy
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
-- Kadir Beyazlı Computer Engineer GSM : +90 535 821 50 00
On 5/12/2015 8:50 AM, Andrew Beverley wrote:
On Fri, 2015-12-04 at 16:37 -0500, John Stoffel wrote:
I'm trying to play with Authentication in Dancer2, and I can't get the dang example from Gabor at his blog (http://perlmaven.com/password-protecting-web-pages-in-dancer2) to run, it keeps giving me the following error:
No Auth::Extensible realms configured with which to authenticate user Your example works for me. Are you sure the app is reading your config at all?
The config and code in John's example looks ok.
And I'm invoking it like this:
~/tmp/Dancer2> ../../perl5/perlbrew/perls/perl-5.14.2/bin/plackup -R . app.pl
Dancer2 uses a heuristic to locate app config files if $ENV{DANCER_CONFDIR} is not set. This iterates up the directory structure looking for ./bin and ./lib sub-directories or a .dancer file. Based on having those routes defined in app.pl, I'm assuming that you had no ./bin and ./lib subdirs in ~/tmp/Dancer2, so the heuristic doesn't find the config file there. Creating a .dancer file (content is not important) in that directory will resolve that. Regards, Russell.
"Andrew" == Andrew Beverley <andy@andybev.com> writes:
Andrew> On Fri, 2015-12-04 at 16:37 -0500, John Stoffel wrote:
I'm trying to play with Authentication in Dancer2, and I can't get the dang example from Gabor at his blog (http://perlmaven.com/password-protecting-web-pages-in-dancer2) to run, it keeps giving me the following error:
No Auth::Extensible realms configured with which to authenticate user
Andrew> Your example works for me. Are you sure the app is reading Andrew> your config at all? I'm pretty sure it is, because when I put in something wrong, it barks at me. And when I do save the file, I also see the plackup messages that it's re-reading the file. Andrew> Try dumping config() from a route, and checking whether it Andrew> contains your configuration (bear in mind that it will still Andrew> contain default information if your config isn't being read). Andrew> If it is, also check that the dump contains your Andrew> Auth::Extensible config. I suspect it's some wierd interaction of my perlbrew setup with my existing local setup which is driving this problem. I wonder if I'm reading in a mix of ancient perl5 modules and the newer perlbrew modules because of my PERL5LIB environment. Gah!!! Sorry to bug you all...
On Sat, 2015-12-05 at 09:05 -0500, John Stoffel wrote:
Andrew> Your example works for me. Are you sure the app is reading Andrew> your config at all?
I'm pretty sure it is, because when I put in something wrong, it barks at me. And when I do save the file, I also see the plackup messages that it's re-reading the file.
I guess the bottom line is that the warning wouldn't be displayed if the module config was being passed correctly to Auth::Extensible.
Andrew> Try dumping config() from a route, and checking whether it Andrew> contains your configuration (bear in mind that it will still Andrew> contain default information if your config isn't being read).
Andrew> If it is, also check that the dump contains your Andrew> Auth::Extensible config.
I suspect it's some wierd interaction of my perlbrew setup with my existing local setup which is driving this problem.
Maybe try dumping the config file in a few key places? You should be able to do that in Extensible.pm by dumping $app->config in on_plugin_import()
On Sat, Dec 5, 2015 at 4:05 PM, John Stoffel <john@stoffel.org> wrote:
"Andrew" == Andrew Beverley <andy@andybev.com> writes:
I suspect it's some wierd interaction of my perlbrew setup with my existing local setup which is driving this problem. I wonder if I'm reading in a mix of ancient perl5 modules and the newer perlbrew modules because of my PERL5LIB environment.
print out the content of %INC to see what has been loaded. Gabor
participants (5)
-
Andrew Beverley -
Gabor Szabo -
John Stoffel -
Kadir Beyazlı -
Russell Jenkins