[dancer-users] Dancer2::Plugin::Auth::Extensible with DB
Clive Eisen
clive at hildebrand.co.uk
Thu Nov 23 10:28:31 GMT 2017
Hi
Apologies for the length of this but I wanted to include everything I have tried.
I have been using Dancer2::Plugin::Auth::Extensible <http://search.cpan.org/perldoc?Dancer2%3A%3APlugin%3A%3AAuth%3A%3AExtensible> for a while - all good.
I am now trying to use Dancer2::Plugin::Auth::Extensible::Provider::Database <http://search.cpan.org/perldoc?Dancer2%3A%3APlugin%3A%3AAuth%3A%3AExtensible%3A%3AProvider%3A%3ADatabase>
thus
session: Cookie
template: template_toolkit
engines:
template:
template_toolkit:
start_tag: '<%'
stop_tag: '%>'
session:
Cookie:
secret_key: thisisverysecret!
default_duration: 604800
plugins:
Auth::Extensible:
disable_roles: 1
realms:
users:
provider: 'Database'
users_table: ot_users
# roles_table: ot_roles
# user_roles_table: ot_user_roles
Database:
dsn: "dbi:Informix:ehive_support2012"
#driver: 'Informix'
#database: 'ehive_support2012'
username: *******
password: *******
log_queries: 1
on_connect_do: ['set explain on']
dbi_params:
PrintError: 0
RaiseError: 1
AutoCommit: 1
Once I got past the db connection errors I added and entry in the ot_users table for me using
create_user username => "clive", email => 'clive at hildebrand.co.uk', email_welcome => 0;
and
user_password username => 'clive', new_password => 'secret';
And indeed I can manually run
SELECT * FROM "ot_users" WHERE "username”=‘clive’
and it works
In addition the following test program also works
#!/usr/bin/env perl
use DBI;
use Data::Dumper;
my $dbh_support = DBI-> connect("dbi:Informix:ehive_support2012", ‘*******' , ‘*******', { RaiseError=> 0, AutoCommit => 1, PrintError => 1, PrintWarn => 1}) or die("Connect failed $DBI::errstr");
$sel = $dbh_support->prepare(qq(SELECT * FROM "ot_users" WHERE "username"=?));
$sel->execute('clive');
my $a = $sel->fetchrow_hashref;
print Dumper($a);
producing
$VAR1 = {
'password' => '{SSHA512}Jr34UXRpsaCQSWsJJE/Qq84fpq6RBVi',
'email' => 'clive at hildebrand.co.uk',
'pw_reset_code' => 'Ct1FIiUkwdiLSRVYUQCOyQYEquSV5RRe',
'username' => 'clive',
'id' => '3',
'hid' => undef
};
However the login is failing and I am just returned to the login screen with the banner set to LOGIN FAILED
There is no indication WHAT is failing - can anyone suggest either what is wrong or where I can add debug - I have tried with and without roles.
[otweb:22772] core @2017-11-23 10:10:22> looking for post /login in /root/perl5/perlbrew/perls/perl-5.24.1/lib/site_perl/5.24.1/Dancer2/Core/App.pm l. 35
[otweb:22772] core @2017-11-23 10:10:22> Entering hook core.app.before_request in (eval 718) l. 1
[otweb:22772] core @2017-11-23 10:10:22> Entering hook plugin.auth_extensible.before_authenticate_user in (eval 718) l. 1
[otweb:22772] debug @2017-11-23 10:10:22> Attempting to authenticate clive against realm users in /root/perl5/perlbrew/perls/perl-5.24.1/lib/site_perl/5.24.1/Dancer2/Core/Route.pm l. 140
[otweb:22772] core @2017-11-23 10:10:22> Entering hook plugin.database.database_connected in (eval 718) l. 1
[otweb:22772] debug @2017-11-23 10:10:22> Executing SELECT query SELECT * FROM "ot_users" WHERE "username"=? with params clive in /root/perl5/perlbrew/perls/perl-5.24.1/lib/site_perl/5.24.1/Dancer2/Plugin.pm l. 532
[otweb:22772] core @2017-11-23 10:10:22> Entering hook plugin.auth_extensible.after_authenticate_user in (eval 718) l. 1
[otweb:22772] core @2017-11-23 10:10:22> looking for get /login in /root/perl5/perlbrew/perls/perl-5.24.1/lib/site_perl/5.24.1/Dancer2/Core/App.pm l. 35
[otweb:22772] core @2017-11-23 10:10:22> Entering hook core.app.before_request in (eval 718) l. 1
[otweb:22772] debug @2017-11-23 10:10:22> app has no login template defined in /root/perl5/perlbrew/perls/perl-5.24.1/lib/site_perl/5.24.1/Dancer2/Plugin/Auth/Extensible.pm l. 283
[otweb:22772] core @2017-11-23 10:10:22> Entering hook core.app.after_request in (eval 718) l. 1
--
Clive Eisen
GPG: 3818B5F1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20171123/3614467a/attachment.html>
More information about the dancer-users
mailing list