Merge branch 'issue-2672-password-hash-list' into 'v2.0'

DBI password hash list

See merge request lemonldap-ng/lemonldap-ng!245
This commit is contained in:
Clément OUDOT 2022-01-22 15:01:47 +00:00
commit 23fe6d3481
2 changed files with 7 additions and 12 deletions

View File

@ -38,12 +38,8 @@ LL::NG can use two tables:
Authentication table and user table can be the same.
The password can be in plain text, or encoded with a standard SQL
method:
- SHA
- SHA1
- MD5
The password can be in plain text, or encoded with a SQL method (for example
``SHA``, ``SHA1``, ``MD5`` or any method valid on database side).
Example 1: two tables
^^^^^^^^^^^^^^^^^^^^^
@ -159,7 +155,8 @@ Password
~~~~~~~~
- **Hash schema**: SQL method for hashing password. Can be left blank
for plain text passwords.
for plain text passwords. The method will be forced to uppercase in
SQL statement.
- **Dynamic hash activation**: Activate dynamic hashing. With dynamic
hashing, the hash scheme is recovered from the user password in the
database during authentication.

View File

@ -12,7 +12,7 @@ use Mouse;
extends 'Lemonldap::NG::Common::Module';
our $VERSION = '2.0.0';
our $VERSION = '2.0.14';
# PROPERTIES
@ -91,16 +91,14 @@ sub init {
# @return SQL statement string
sub hash_password {
my ( $self, $password, $hash ) = @_;
if ( $hash =~ /^(md5|sha|sha1|encrypt)$/i ) {
if ($hash) {
$self->logger->debug( "Using " . uc($hash) . " to hash password" );
return uc($hash) . "($password)";
}
else {
$self->logger->notice(
"No valid password hash, using clear text for password");
$self->logger->debug("No password hash, using clear text for password");
return $password;
}
}
# Return hashed password for use in SQL SELECT statement