I need help with the syntax for salting a password using CGI::Application::Plugin::Authentication and Digest::MD5.
1. the password is entered by the user
2. the salt found in TableB is added
3. the salt and the password are MD5 encrypted
4. the results are then to be compared to the salted password already in TableA
(The salt is in TableB and the md5 salted password is in TableA -- joined on column2.)
I believe that I need to use a custom filter. I've read and re-read the CPAN examples but I still can't "get it". Any help or links to other examples would be appreciated.
TABLES => ['column1 TableA, 'column1 TableB'], JOIN_ON => 'TableA.column2 = TableB.column2', CONSTRAINTS => { 'TableA.username' => '__CREDENTIAL_1__', 'md5_base64:salt:password' => '__CREDENTIAL_2__', 'TableB.column3' => __CREDENTIAL_3__', } FILTERS => { salt => \&salt_filter }, ], sub salt_filter { my $param = shift; my $value = shift; $value = $dbh->prepare ("SELECT salt FROM TableB JOIN TableA ON TableB.column2 = TableA.column2 "); return $value; }
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |