akuk has asked for the wisdom of the Perl Monks concerning the following question:
Hi Folks,
I am working on a Project to migrate the Legacy App in Perl to Catalyst Framework. Legacy app has its own authentication mechanism. And it uses Crypt::PBKDF2 to store the password in the database.
I want to use Catalyst::Plugin::Authentication instead of custom login mechanism for catalyst but I didn't find a way to authenticate password using Authentication Plugin
Legacy:
$pbk_crypt = Crypt::PBKDF2->new( hash_class => 'HMACSHA2', hash_args => { sha_size => 512, }, iterations => 10000, salt_len => 10, ); $pass = $pbk_crypt->generate('password');
Catalyst
And in the User table following code is added:__PACKAGE__->config( 'Plugin::Authentication' => { default => { class => 'SimpleDB', user_model => 'DB::User', password_type => 'self_check', }, )
__PACKAGE__->add_columns( 'password' => { passphrase => 'rfc2307', passphrase_class => 'SaltedDigest', passphrase_args => { algorithm => 'SHA-512', salt_random => 10, iterations => 10000, }, passphrase_check_method => 'check_password', }, );
And in Controller :
but it's not working. I am not sure what I am doing wrong here.if ($username and $password) { if ($c->authenticate({ username => $username, password => $password } )) { $c->response->redirect($c->uri_for_action('/profile')); return; } else { # Set an error message $c->stash(error_msg => "Bad username or password."); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Catalyst
by Your Mother (Archbishop) on Oct 10, 2018 at 17:37 UTC | |
by akuk (Beadle) on Oct 10, 2018 at 18:14 UTC | |
by akuk (Beadle) on Oct 10, 2018 at 19:15 UTC | |
by Your Mother (Archbishop) on Oct 10, 2018 at 20:27 UTC | |
|
Re: Perl Catalyst
by Corion (Patriarch) on Oct 10, 2018 at 13:58 UTC | |
by akuk (Beadle) on Oct 10, 2018 at 15:00 UTC |